请看这个 fiddle :
http://jsfiddle.net/Smartix/98sdrnkk/
:before
css 属性似乎不适用于引导行。
在上面的例子中,一条居中的红线应该显示在类 myline
的 div 的背景中。
最佳答案
将您的 :after 伪类应用到此规则(在 col-xs-12 之后):
<div class="row myline">
<div class="col-xs-12 myline">
<p>A red line should appear in the background of this row</p>
<p>The line should span from the top of the row...</p>
<p>... till here. Why is there no line?</p>
</div>
</div>
或者只添加一个高度值,它会正常工作:
.myline:before {
content: '';
top: 0;
bottom: 0;
position: absolute;
width: 4px;
background-color: red;
left: 50%;
margin-left: -1.5px;
height: 100px;
}
关于css - Bootstrap 3 行和 css :before property,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29196045/