【发布时间】:2021-04-12 19:12:45
【问题描述】:
我尝试使用 CSS 创建一个三角形,它看起来不错,但是我现在在一个框后实现它时遇到了问题。
看看我的例子,你就会明白我的意思:
.box 之后的三角形似乎被“切断”了,我完全不知道为什么会发生这种情况。
我希望它看起来像 .arrow。
我试图改变盒子、三角形等的尺寸,但没有任何效果。
附言如果 Jsfiddle 很慢或不再可用,这是 css:
.box{
background:red;
height:40px;
width:100px;
}
/*the triangle but its being cut off*/
.box:after{
content:"";
width:0;
height:0;
border-top:20px solid transparent;
border-bottom:20px solid transparent;
border-left:20px solid green;
}
/*the triangle how it should look like*/
.arrow{
width:0;
height:0;
border-top:20px solid transparent;
border-bottom:20px solid transparent;
border-left:20px solid green;
}
【问题讨论】:
标签: css