700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > html 中箭头的代码 HTML中利用div+CSS实现简单的箭头图标的代码

html 中箭头的代码 HTML中利用div+CSS实现简单的箭头图标的代码

时间:2022-10-05 15:03:57

相关推荐

html 中箭头的代码 HTML中利用div+CSS实现简单的箭头图标的代码

/*箭头向上*/

.to_top {

width: 0;

height: 0;

border-bottom: 10px solid #ccc;

border-left: 10px solid transparent;

border-right: 10px solid transparent;

}

/*箭头向下*/

.to_bottom {

width: 0;

height: 0;

border-top: 10px solid #ccc;

border-left: 10px solid transparent;

border-right: 10px solid transparent;

}

/*箭头向左*/

.to_left {

width: 0;

height: 0;

border-right: 10px solid #ccc;

border-top: 10px solid transparent;

border-bottom: 10px solid transparent;

}

/*箭头向右*/

.to_right {

width: 0;

height: 0;

border-left: 10px solid #cccf;

border-top: 10px solid transparent;

border-bottom: 10px solid transparent;

}

HTML代码

向上箭头

向左箭头

向右箭头

向下箭头

代码运行结果

如果你感觉箭头过大或太小,以及颜色不是你想要的,我们可以通过调整DIV的边框的粗细以及颜色来,来调整箭头的大小

DIV+CSS实现大箭头的效果

昨天在修改三栏主题的时候,有用户反馈说,要加入一个左右大箭头。虽然实现起来很简单(可以使用背景图片代替),但是要加一个后台可以自定义颜色的功能,所以就想到了利用DIV+CSS来画箭头,这样自己可以很方便的给箭头自定义颜色啦

CSS代码

.text{

display: inline-block;

border-top: 2px solid;

border-right: 2px solid;

width: 100px;

height: 100px;

border-color: #EA6000;

transform: rotate(-135deg);

margin: 50px auto auto 100px;

}

HTML代码

代码运行结果

我们可以通过修改C以下的代码,进行箭头方式的改充数,也可以修改,width(宽)与height(高),来实现箭头大小的改变。

transform: rotate(-135deg);/*调整旋转的角度*/

总结

以上所述是小编给大家介绍的HTML中利用div+CSS实现简单的箭头图标的代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!

如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:php中文网

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。