gpt4 book ai didi

css - 调整 bootstrap jumbotron 背景图像以避免与文本冲突

转载 作者:行者123 更新时间:2023-11-28 04:29:19 33 4
gpt4 key购买 nike

我有一个带有背景图像和文本的超大屏幕。我需要调整图像,使文本不会与背景图像的任何部分发生冲突。

HTML:

<div class="jumbotron">
<div class="container">
<h1>Header title text</h1>
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. </p>
</div>
</div>

CSS:

.jumbotron {
position: relative;
background: #fff url("https://s3.us-east-2.amazonaws.com/ftp-assets/family.png") center center;
width: 100%;
height: 400px;
background-size: cover;
}

h1 {
margin-top: -30px;
margin-left: -20px;
}

p {
margin-left: -2%;
}

JSFIDDLE:https://jsfiddle.net/2ek2e2rf/

最佳答案

尝试转换成这样的东西:

<div class="jumbotron jumbotron-fluid bg-dark">
<div class="jumbotron-background">
<img src="assets/background_img4.jpg" class="blur ">
</div>
<div class="container text-white" style="background-color: transparent; border: none;">
<h1>Some text</h1>
</div>
</div>

然后,您可以通过更改以下属性来调整背景:

.jumbotron-background {
top: 50px;
bottom: 50px;
left: 50px;
right: 50px;
}

关于css - 调整 bootstrap jumbotron 背景图像以避免与文本冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41812926/

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