我需要在一些块之后绘制一条水平线,我有三种方法可以做到:
1)定义一个类h_line并为其添加css功能,例如
#css
.hline { width:100%; height:1px; background: #fff }
#html
<div class="block_1">Lorem</div> <div class="h_line"></div>
Run Code Online (Sandbox Code Playgroud)
2)使用hr标签
#css
hr { width:100%; height:1px; background: #fff }
#html
<div class="block_1">Lorem</div> <hr />
Run Code Online (Sandbox Code Playgroud)
3)像after伪类一样使用它
#css
.hline:after { width:100%; height:1px; background: #fff; content:"" }
#html
<div class="block_1 h_line">Lorem</div>
Run Code Online (Sandbox Code Playgroud)
哪种方式最实用?