用CSS样式实现箭头效果代码

有时候网页中使用箭头以增强效果,一般的做法是使用图片,但是使用CSS样式也一样可以来实现“箭头效果”。而且效果非常绚丽。
具体的颜色代码可以根据自己的需要去替换!

代码如下:

<style type="text/css">

table{width:50%; font-size:14px; font-family:Arial; color:#333}
.arrow-top,.arrow-right,.arrow-bottom,.arrow-left{font-size:0; line-height:0; height:0; width:0; cursor:pointer}
.box{ border:1px solid #CCC; width:100px; height:100px; padding:10px; background:#EEE; margin:10px}
.arrow{ border-width:50px; border-color:red green blue black; border-style:solid solid solid solid}
.arrow-bottom{ border-width:50px; border-color:red transparent transparent transparent; border-style:solid dashed dashed dashed; border-bottom:none;}
.arrow-left{ border-width:50px; border-color:transparent green transparent transparent; border-style:dashed solid dashed dashed; border-left:none;}
.arrow-top{ border-width:50px; border-color:transparent transparent blue transparent; border-style:dashed dashed solid dashed; border-top:none;}
.arrow-right{ border-width:50px; border-color:transparent transparent transparent black; border-style:dashed dashed dashed solid; border-right:none;}
</style>

<table>
<tr>
<td>
<div class="box">
<div class="arrow"></div>
</div>
</td>
<td>
<p>.arrow{ border-width:50px; border-color:red green blue black; border-style:solid solid solid solid}</p>
</td>
</tr>
<tr>
<td>
<div class="box">
<div class="arrow-top"></div>
</div>
</td>
<td>
<p>.arrow-top{ border-width:50px; border-color:red transparent transparent transparent; border-style:solid dashed dashed dashed; border-bottom:none;}
</p>
</td>
</tr>
<tr>
<td>
<div class="box">
<div class="arrow-right"></div>
</div>
</td>
<td>
<p>.arrow-right{ border-width:50px; border-color:transparent green transparent transparent; border-style:dashed solid dashed dashed; border-left:none;}
</p>
</td>
</tr>
<tr>
<td>
<div class="box">
<div class="arrow-bottom"></div>
</div>
</td>
<td>
<p>.arrow-bottom{ border-width:50px; border-color:transparent transparent blue transparent; border-style:dashed dashed solid dashed; border-top:none;}
</p>
</td>
</tr>
<tr>
<td>
<div class="box">
<div class="arrow-left"></div>
</div>
</td>
<td>
<p>.arrow-left{ border-width:50px; border-color:transparent transparent transparent black; border-style:dashed dashed dashed solid; border-right:none;}
</p>
</td>
</tr>
</table>

用CSS样式实现箭头效果如下:

.arrow{ border-width:50px; border-color:red green blue black; border-style:solid solid solid solid}

.arrow-top{ border-width:50px; border-color:red transparent transparent transparent; border-style:solid dashed dashed dashed; border-bottom:none;}

.arrow-right{ border-width:50px; border-color:transparent green transparent transparent; border-style:dashed solid dashed dashed; border-left:none;}

.arrow-bottom{ border-width:50px; border-color:transparent transparent blue transparent; border-style:dashed dashed solid dashed; border-top:none;}

百人牛牛.arrow-left{ border-width:50px; border-color:transparent transparent transparent black; border-style:dashed dashed dashed solid; border-right:none;}

未经允许不得转载:欲思博客 » 用CSS样式实现箭头效果代码
喜欢(0) 打赏

评论抢沙发

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

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

在线客服

在线客服

  • 扫描二维码,微信联系 扫描二维码,微信联系