gpt4 book ai didi

html - 使用 Bootstrap 3.0 的多个堆叠全宽背景图像

转载 作者:太空狗 更新时间:2023-10-29 15:05:24 28 4
gpt4 key购买 nike

我正在尝试使用 Bootstrap 3.0 构建一个静态网页。

该页面基本上是一个叙述,由一系列带有背景图像的堆叠部分组成,文本和其他图像/元素叠加在顶部。

I've

页面只是设计为从上到下滚动,每个部分的背景图像应填充水平宽度。

稍后,我还将使用 Skrollr ( https://github.com/Prinzhorn/skrollr ) 为图像添加视差。

但是,现在,我正在努力使用 Bootstrap 来处理 HTML/CSS。

最初,我以为我可以做这样的事情:

<body>
<div class="container">
<section id="first">
<div class="row annoucement col-md-4 col-md-offset-4">
<h1>The story of...</h1>
</div>
</section
<section id="second">
<div class="row gallery col-md-4 col-md-offset-4">
<!-- Image gallery boxes -->
</div>
</section
</div>

然后在 CSS 中:

    #first {
background: url(img/1.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

但是,背景图像不可见 - #first 元素为 1140px x 0px,因此未显示图像。

我怀疑我没有正确使用标签类型 - 关于如何让上述布局与 Bootstrap 一起工作有什么建议吗?

最佳答案

您对网格系统的标记不正确,您应该查看 the examples从文档中,基本上 .row 应该是一个容器元素,如果你想让背景覆盖整个页面那么你不能在容器内有这些部分,这就是我想要的建议:

<body>
<section id="first">
<div class="container">
<div class="row announcement">
<div class="col-md-4 col-md-offset-4">
<h1>The story of...</h1>
</div>
</div>
</div>
</section>
<section id="second">
<div class="container">
<div class="row gallery">
<div class="col-md-4 col-md-offset-4">
<!-- Image gallery boxes -->
</div>
</div>
</div>
</section>
</body>

尽管您可能希望为您的内容使用更大的跨度大小,因为我认为 col-md-4 太小了,但这由您决定:)

关于html - 使用 Bootstrap 3.0 的多个堆叠全宽背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18671572/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com