html示例 一开始这样写不生效
<div> <span>示例代码</span> </div>
span{ content:""; width: 89px; height: 2px; background: #02B7CA; border: 2px solid #02B7CA; }
伪元素添加display:inline-block;
span{ content:""; display: inline-block; width: 89px; height: 2px; background: #02B7CA; border: 2px solid #02B7CA; }
2.元素使用相对定位,伪元素使用绝对定位
div{ position: relative; } span{ content:""; position: absolute; width: 89px; height: 2px; background: #02B7CA; border: 2px solid #02B7CA; }