书小宅之网页设计——CSS3的应用

使用CSS3绘制直线就是通过修改div块元素的样式来实现
伪类:after
在被选元素的内容后面插入内容。
伪类:before
在被选元素的内容后面插入内容。

CSS3绘制直线

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>画线</title>
<style>
    .line1{width:200px; height:1px; background-color:#f00; display:inline-block; vertical-align:6px}
   
   .line2:before,.line2:after{content:""; width:200px; height:1px; background-color:#aaa; display:inline-block}
   .line2:before{background-color:#f00; width:50px; height:4px;;}
	  
   .line3:before,.line3:after{content:""; width:100px; height:1px; background-color:#aaa; display:inline-block; }
   
   /*交叉*/
   .line4{position: relative;}
   .line4:before,.line4:after{content: "";width: 200px;height:
   1px;background-color: #aaa;display: inline-block; vertical-align:6px}
   .line4:after{width: 2px; background-color: #f00; height: 20px; position: absolute;left: 30px;top: 3px;}
   
   .line5{width:200px; height:50px; border:5px solid hsla(192,89%,32%,1.00); margin-top:20px; border-top-style:hidden;}
</style>
</head>

<body>
<section>
	<span>形态特征</span>
    <div class="line1"></div>
    <div class="line2"></div>
    <div class="line3"><b>今日头条</b></div>
    <div class="line4"></div>
    <div class="line5"></div>
</section>
<script>
</script>
</body>
</html>

结果演示
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值