css - Bootstrap 3 行和 css :before property

标签 css twitter-bootstrap-3

请看这个 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>

LIVE DEMO

或者只添加一个高度值,它会正常工作:

.myline:before {
    content: '';
    top: 0;
    bottom: 0;
    position: absolute;    
    width: 4px;
    background-color: red;
    left: 50%;
    margin-left: -1.5px;
    height: 100px;
}

Live Demo

关于css - Bootstrap 3 行和 css :before property,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29196045/

相关文章:

javascript - Twitter Typeahead - 如何使用 "afterSelect"跳转到网站的另一个部分?

css - Div 对齐无法正常工作

javascript - 如何做自动滚动

css - 输入框高度问题

html - Bootstrap 侧边栏下的内容

html - div不粘在屏幕左侧

html - 未定义方法 `stringify_keys' (ROR)

html - iframe 仅在 Firefox 中不显示

html - 按钮不适用于 .pull-left (Bootstrap)

css - Bootstrap 3 中的网格系统问题