分享你我的心得.
共乘一片美好网络.

纯CSS实现小箭头的方法

我们大多数的小箭头都是用小图片来做的,这里分享一款用纯CSS写的小箭头,大家可以看看,以后会放出更多的CSS小箭头来供大家参考。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<div class="pre-wrap">
    <div class="pre">
        <div class="pre1"></div>
        <div class="pre2"></div>
    </div>
</div>
<style>
	.pre-wrap {
	width: 200px;
	height: 120px;
	margin: 50px auto 0;
	border: 2px solid #F00;
	border-radius: 4px;
	position: relative;
}
.pre {
	width: 80px;
	height: 80px;
	position: absolute;
	top: 20px;
	left: 40px;
}
.pre1 {
	border-width: 40px;
	border-color: transparent #F30 transparent transparent;
}
.pre2 {
	border-width: 40px;
	border-color: transparent #FFF transparent transparent;
	position: relative;
	top: -80px;
	left: 15px;
}
.pre1, .pre2 {
	/*****设置border-style:dashed;使ie6支持border透明*****/
	border-style: dashed solid dashed dashed;
    /*****设置容器宽高为0*****/
	width: 0;
	height: 0;
	/*****去掉ie6下默认高度,设置以下属性*****/
	line-height: 0;
	font-size: 0;
	overflow: hidden;
 
}
</style>
赞(0)
未经允许不得转载:小叶白龙博客 » 纯CSS实现小箭头的方法
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址