如何使用CSS制作箭头符号


当前第2页 返回上一页

将显示一个带有红色三角形的图标

2345截图20181208102042.png

“大于号”的箭头

CSS代码

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

.arrow{

  position: relative;

  display: inline-block;

  padding-left: 20px;

}

 

.arrow::before{

  content: '';

  width: 6px;

  height: 6px;

  border: 0px;

  border-top: solid 2px #5bc0de;

  border-right: solid 2px #5bc0de;

  -ms-transform: rotate(45deg);

  -webkit-transform: rotate(45deg);

  transform: rotate(45deg);

  position: absolute;

  top: 50%;

  left: 0;

  margin-top: -4px;

}

运行结果

在浏览器上运行效果如下

2345截图20181208103201.png

在网页上这个箭头符号是经常可以用到的

制作向上的箭头

CSS代码

1

2

3

4

5

6

7

8

9

.arrow{

  width: 0px;

  border-color: #d9534f;

  border-style: solid;

  border-width: 30px;

  border-left-color: transparent;

  border-top-color: transparent;

  border-right-color: transparent;

}

运行效果

在浏览器上显示如下效果

箭头

最后我们来看一下传统向右的箭头符号

CSS代码

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

.arrow {

  display:inline-block;

  height:40px;

  width:80px;

  background-color:#5bc0de;

  position:relative;

  top:40px;

}

 

.arrow:before {

  position:absolute;

  content:"";

  width:0;

  height:0;

  border:60px solid transparent;

  border-left:60px solid #5bc0de;

  left:80px;

  top:-37px;

}

运行结果

在浏览器上将显示如下所示的效果

2345截图20181208104008.png

本篇文章到这里就全部结束了,更多相关的精彩内容大家可以移步到php中文网的CSS视频教程栏目进一步的学习!!!

以上就是如何使用CSS制作箭头符号的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

如何在css中实现并排生成多行的dt和dd

css如何设置边框

css实现轮播图效果(附代码)

css3实现条状百分比效果

css如何进行空格处理

css如何设置表格标题(caption标签)的位置

文字居中的css代码是什么

css如何关闭浮动

css flex 的用途详解

css word-wrap属性怎么用

更多相关阅读请进入《css》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...