gpt4 book ai didi

css - Bootstrap 3 整页图像背景

转载 作者:太空宇宙 更新时间:2023-11-03 18:13:17 24 4
gpt4 key购买 nike

我使用以下 CSS 在我的页面上有一个完整的页面背景图片:

.full {
background: url(images/background.png') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

这是附加到 HTML 类:

<html class="full">

我现在正尝试使用基本的方法将内容置于此之上:

<div class="container">Text Here</div>

结果导致容器将背景图像向下推并将内容放在其上方。我怎样才能让这个内容漂浮在图像之上?

最佳答案

您的问题可能出在 bootstrap.css 中的这一行

body {
background-color: #FFF;
}

可能给人的印象是您的背景图像被压低了,但实际上只是在图像上应用了容器内容高度的白色背景。

解决此问题的一个方法是覆盖自定义 css 中的 body css:

body {
background: transparent;
}

关于css - Bootstrap 3 整页图像背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23280258/

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