简体   繁体   English

Bootstrap 列全内容背景色

[英]Bootstrap column full content background-color

This is what I want to do :这就是我想要做的:在此处输入图片说明

And this is what I have :这就是我所拥有的:在此处输入图片说明

And this is my code :这是我的代码:

Html html

<div class="row">
  <div class="col-md-4">col-md-4</div>
  <div class="col-md-6">col-md-6 ...</div>
  <div class="col-md-2">col-md-2</div>
</div>

Css css

.col-md-4,.col-md-2 {
background-color: #e3e3e3;
}

.col-md-6 {
background-color: #f5f3f3;
}

I checked other questions on the subject but I'm not satisfied with the answers... can someone help me to improve my code ?我检查了有关该主题的其他问题,但我对答案不满意......有人可以帮助我改进我的代码吗? thank you !谢谢你 !

Look here in JSFiddle...看看这里的JSFiddle ......

I hope you are looking for this output.我希望你正在寻找这个输出。 If yes then try the following code:如果是,请尝试以下代码:

JSFiddle 代码的输出

HTML: HTML:

<div class="row">
    <div class="col-md-4 row-height">
        <span>col-md-4</span>
    </div>
    <div class="col-md-6 row-height">
        col-md-6
    </div>
    <div class="col-md-2 row-height">
        col-md-2
    </div>
</div>

And CSS:和 CSS:

.row {
    padding: 100px;
}

.row-height {
    height: 70px;
    text-align: center;
    padding-top: 25px;
}

.col-md-4,.col-md-2 {
    background-color: #e3e3e3;
}

.col-md-6 {
    background-color: #f5f3f3;
}

.col-md-4 {
    border-radius: 15px 0 0 15px;
}

.col-md-2 {
    border-radius: 0 15px 15px 0;
}

You can modify the CSS the way you want and sizes in the styles according to the content.您可以按照您想要的方式修改 CSS,并根据内容调整样式的大小。

Hope this helps...希望这可以帮助...

You could color the entire .row and then the middle column separately..您可以分别为整个.row和中间列.row ..

.row {
    background-color: #e3e3e3;
    border-radius: 15px;
}

.col-md-6 {
    background-color: #f5f3f3;
}

http://codeply.com/go/FXSkrecwwI http://codeply.com/go/FXSkrecwwI

Try this CSS:试试这个 CSS:

.row {
  display: table; 
  width: 100%; 
}

.col {
  display: table-cell;
}

.col-md-4,
.col-md-2 {
  background-color: #e3e3e3;
}

.col-md-6 {
  background-color: #f5f3f3;
}

Add a custom class say myfix to the column div elements and set height:100%;添加自定义类myfix到列 div 元素并设置height:100%; . .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM