有没有一种方法可以使选择器填充到可用空间的右侧,而使左侧保持不变?



我希望红线填充可用空间的右侧,这可以实现吗?

.grey {
    border-left:1px solid #d1d1d1;
    background: #e0e0e0;
}

    .grey:before {
        content:'';
        width:100%;
        height:100%;
        background:red;
        position:absolute;
        z-index:-99;
    }


我正在使用Bootstrap RC2。
.grey类将添加到col-4 div中。

我希望屏幕的左侧保持不变,但右侧要填充“红色”颜色。
颜色应从col-4 div开始。

最佳答案

尝试使用calc()

样本FIDDLE

.container:before{
    content: '';
    height: 100%;
    background: red;
    position: absolute;
    top:0;
    right: 0;
    width: calc(((100% - 1170px)/2));
}

关于html - 选择器填充可用空间之前的CSS,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18333731/

10-12 16:27
查看更多