CSS中实现空心三角箭头的方法是什么
Admin 2022-11-18 群英技术资讯 736 次浏览
第一种写法 利用常见的 after伪元素
<!DOCTYPE html>
<
html
>
<
head
>
<
meta
charset
=
"UTF-8"
>
<
title
></
title
>
<
style
type
=
"text/css"
>
.arrow {
width: 20px;
height: 4px;
margin: 0 auto 7px;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-bottom: 4px solid #343c99;
transform: rotate(45deg);
transform-origin: left;
}
.arrow:after {
content: '';
display: block;
width: 100%;
height: 100%;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 4px solid #343c99;
position: absolute;
right: -10px;
top: -14px;
transform: rotate(90deg);
transform-origin: bottom;
}
</
style
>
</
head
>
<
body
>
<
div
class
=
"arrow"
></
div
>
</
body
>
</
html
>
第二种写法相对于比较简单
<!DOCTYPE html>
<
html
>
<
head
>
<
meta
charset
=
"UTF-8"
>
<
title
></
title
>
<
style
type
=
"text/css"
>
/*简单*/
.wb_arrow{
border-right: 2px solid #343c99;
border-top: 2px solid #343c99;
height: 10px;
width: 10px;
margin:50px auto 0;
transform: rotate(deg);
-webkit-transform: rotate(0deg);
/*不加这两个属性三角会比上一个略丑, 大家可以试一下*/
border-left: 2px solid transparent;
border-bottom: 2px solid transparent;
}
</
style
>
</
head
>
<
body
>
<
div
class
=
"wb_arrow"
></
div
>
</
body
>
</
html
>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
本篇文章给大家带来的内容是关于什么是canvas离屏技术?canvas放大镜效果如何实现?,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
css中可利用background-image属性实现图片按钮效果,写法为“按钮元素{background-image:url(图片路径)}”;background-image属性用于设置元素背景图像,利用该属性给按钮元素添加背景图片即可。
对于CSS3实现渐变背景的内容,我们之前也了解了很多,我们知道实现渐变背景并不困难,但是因为浏览器的版本问题,css3渐变背景的兼容问题大家要注意,对此这篇文章就给大家分享一下css3渐变背景的兼容问题的解决方法。
css设置hr居中的方法在css中可以利用“text-align:center;”属性设置hr居中,text-align属性规定元素中的文本的水平对齐方式。该属性通过指定行框与哪个点对齐,从而
css怪异盒模型的介绍:1、怪异盒设置的width/height不仅包含了content盒子内容的宽度/高度,还包含了padding和border的宽度/高度。2、一个块的总宽度= width + margin(左右)。
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008