我想制作一个带有向上箭头的容器。我熟悉边框绘制技巧,认为这是可能的解决方案,但我认为只适用于已知大小,因为您必须以em或px指定边框。
我想要制作的形状如下:
我想要制作的形状如下:
.
/ \
/ \
/ \
| flex |
| |
内容区域可以以父容器的百分比为基础自由调整大小。
下面是 CSS,其中标记了问题区域:
.metric {
display: inline-block;
position: relative;
height: 150px;
width: 50%;
background: lawngreen;
}
.metric:after {
position: absolute;
top: -25px;
left: 0;
content: '';
background: white;
width: 100%;
height: 0;
border: 75px solid white; /* this fixed width is the problem */
border-top: none;
border-bottom: 25px solid lawngreen;
box-sizing: border-box;
}
这里是 jsfiddle 链接:http://jsfiddle.net/C8XJW/2/
你们知道如何实现这个吗?