nek*_*894 1 html css pseudo-element
使用了两个::before具有不同border属性的伪元素(请参阅js小提琴).尽管"你只能使用一个::before和一个::after伪元素"这实际上是有效的.为什么?
https://jsfiddle.net/8L7zou3e/1/
<div class="el"></div>
.el {
position: relative;
margin: 100px 0 0 500px;
width: 300px;
height: 100px;
background-color: #AA4343;
}
.el:before {
content: '';
display: inline-block;
width: 0;
height: 0;
border-top: 50px solid #e86d0a;
border-left: 50px solid transparent;
position: absolute;
top: 0;
left: -50px;
}
.el:before {
content: '';
display: inline-block;
width: 0;
height: 0;
border-bottom: 50px solid #e86d0a;
border-left: 50px solid transparent;
position: absolute;
top: 0px;
left: -50px;
}
Run Code Online (Sandbox Code Playgroud)
你似乎只有一个伪元素.
这就是UI中的内容:
你的CSS级联到:
.el:before {
content: '';
display: inline-block;
width: 0;
height: 0;
border-top: 50px solid #e86d0a;
border-left: 50px solid transparent;
position: absolute;
border-bottom: 50px solid #e86d0a;
border-left: 50px solid transparent;
top: 0;
left: -50px;
}
Run Code Online (Sandbox Code Playgroud)
查看Chrome处理组合CSS的方式:
| 归档时间: |
|
| 查看次数: |
43 次 |
| 最近记录: |