【发布时间】:2014-10-11 04:41:44
【问题描述】:
下面的代码将在<a> 元素的正下方创建一个箭头:
.btn {
position: relative;
display: inline-block;
width: 100px;
height: 50px;
text-align: center;
color: white;
background: gray;
line-height: 50px;
text-decoration: none;
}
.btn:after {
content: "";
position: absolute;
bottom: -10px;
left: 0;
width: 0;
height: 0;
border-width: 10px 50px 0 50px;
border-style: solid;
border-color: gray transparent transparent transparent;
}
<a href="#" class="btn">Hello!</a>
问题是我们必须指明链接宽度才能获得适当大小的箭头,因为我们无法以像素为单位指明边框宽度。
如何制作基于百分比的响应式三角形?
【问题讨论】:
标签: css responsive-design geometry css-shapes