【发布时间】:2018-10-20 20:08:54
【问题描述】:
我正在尝试用这样的线创建一个纯 CSS 箭头...
.arrow {
position:absolute;
left:50%;
}
.arrow_line {
width:2px;
background:darkblue;
height:60px;
margin:auto;
}
.arrow_point {
box-sizing: border-box;
height: 25px;
width: 25px;
border-style: solid;
border-color: darkblue;
border-width: 0px 2px 2px 0px;
transform: rotate(45deg);
transition: border-width 150ms ease-in-out;
margin-top: -24px;
}
<div class="arrow">
<div class="arrow_line"></div>
<div class="arrow_point"></div>
</div>
垂直线似乎永远不会与箭头垂直对齐,我在示例中将其略微漂移以更好地证明它没有相对于箭头居中。
有没有更好的方法来创建 CSS 箭头?
【问题讨论】:
-
为什么不使用 unicode 箭头?
↓ -
为什么你认为你可以将偶数居中?由于这条线只有 2px 宽,你永远不会让它与“点”的尖端完美对齐。
标签: html css css-shapes