DIV+CSS制作斜线效果记录

  DIV+CSS 斜线效果很简单,只需设置一下CSS Border 的边框就能有斜线效果。代码分享给大家,你可以自己变通。

  提示要注意两点:1、DIV宽高的定义。2、DIV在 IE6 中默认是有高度的。

  上图右边是我们要实现的效果,代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
<div id= "box" ></div>
 
<style type= "text/css" >
#box{
     width : 0px ; height : 0px ;
     border : 40px solid #000 ;
     border-top-color : #930 ;
     border-bottom-color : #0C3 ;
     border-left-color : #FC0 ;
     border-right-color : #009 ;
}
</style>

  在FF IE7 IE8 都显示正常,但在IE6中,却如上图左边所示,中间有差距,因此,需要加一行:

  line-height:0px;

  最终代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<div id= "box" ></div>
 
<style type= "text/css" >
#box{
 
     width : 0px ; height : 0px ;
     border : 40px solid #000 ;
     border-top-color : #930 ;
     border-bottom-color : #0C3 ;
     border-left-color : #FC0 ;
     border-right-color : #009 ;
     line-height : 0px ;
}
</style>
</head>

转载于:https://www.cnblogs.com/ranran/p/3586632.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值