右侧列背景和覆盖引导容器

时间:2015-08-19 09:19:10

标签: twitter-bootstrap css3

我想设置第二个col背景颜色。我希望它延伸到 屏幕的一侧,覆盖它所在的容器。任何人都知道我该怎么做?

<div class="container">
          <div class="row">
            <div class="col-xs-12 col-md-6">

            </div>
            <div class="col-xs-12 col-md-6">

            </div>
        </div>
</div>

如此图片所示 sample of design

一如既往,感谢您的时间

2 个答案:

答案 0 :(得分:1)

对于背景颜色,我设置了stylecss class

<div class="col-xs-12 col-md-6" style="background-color:red">

</div>

在css中使用div覆盖包含的div不是一个好习惯。如果您希望它超过其他div,我只需使用z-index

了解更多here.

编辑Snippet dog根据您的要求。

<div class="container" style="left:400; background-color:blue;opacity:0.8;z-index:-1;">
  <h1> here the container starts</h1>
          <div class="row" style="z-index:0;"> <!-- the row is in front of the container, which allows elements to flow past the edge of it-->
            <div class="col-xs-12 col-md-6" style="background-color:green;opacity:0.8; width:100px; height:200px;">
            This div is fully contained, since you didn't apply z index & left to it. It's on the left because you didn't add the float trait to it.
            </div>
            <div class="col-xs-12 col-md-6" style="background-color:red;opacity:0.8;left:0; z-index:1;width:100px; height:200px; float:right;">
            Here the overfolowing div starts.<br> notice how it's partially out of the container.
            </div>
        </div>
  <h1> here the container ends</h1>
</div>

答案 1 :(得分:1)

使用CSS

frmNotification.Show("message"); //default interval would be 1000
frmNotification.Show("message",2000);

如果第二个div高于第一个div

,这会给你想要的效果
import urllib
from bs4 import BeautifulSoup

url = 'http://ashiyane.org/forums/'
connection = urllib.urlopen(url)
data = connection.read()
connection.close()

    # End the connection

data_html = BeautifulSoup(data, 'html.parser')
data_area = data_html.find(id='vietvbb_topstats_t_content')
#title_rows = data_area.find('span', 'topx-content-tab')
title_rows = data_area.findAll("span", { "class" : "topx-content-tab" })


for link in title_rows:
    print link.find_all("a")

注意第二个div上的额外@media (min-width: 992px) { #a { background: red; position: absolute; left: 0; } }