![](/img/trans.png)
[英]Bootstrap jumbotron full width and height of window with background image
[英]Bootstrap Jumbotron Background image Opacity and width and height?
我有以下要求:
我的背景圖片很大: http : //imgur.com/a/qYRGJ
我已經嘗試了網上某處推薦的以下技巧:
<section class="jumbotron">
<div class="img"></div>
<div class="container">
<div class="row">
<h1 class="display-3">Test</h1>
<p class="lead">Test</p>
<p class="lead">
<a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a>
</p>
</div>
</div>
</section>
這是我的 CSS:
section {
position: relative;
background-color: transparent !important;
}
section .img {
position: absolute;
left:0; top:0;
background-size: cover;
min-height: 768px;
width: 100%;
opacity: 0.45;
background-image: url("1.jpg");
z-index: -1;
}
section .container {
background-color: transparent;
}
section .container .row {
background-color: gray;
padding: 1.5em;
}
目前,這破壞了我的代碼。 在此之后創建另一個會導致該部分顯示在背景圖像上。
有人可以推薦滿足我要求的解決方案嗎?
如果您使用此 CSS,則效果很好。 不過總的來說,最好在 Photoshop 中編輯該照片並在那里設置不透明度,而不是在瀏覽器中進行。
<style>
section {
position: relative;
background-color: transparent !important;
}
section .img {
position: absolute;
left:0; top:0;
background-size: cover;
min-height: 768px;
width: 100%;
opacity: 0.45;
background-image: url("http://i.imgur.com/eFMDsVA.jpg");
z-index: -1;
}
section .container {
background-color: transparent;
}
section .container .row {
padding: 1.5em;
}
.jumbotron {
background-color: gray}
</style>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.