我想創建3個水平對齊的背景圖像,並且跨度爲100% width
的瀏覽器,但最大高度爲800px;
我也希望它們縮小響應。我正在使用glorious bootstrap截至目前你看不到圖像B/C它不是閱讀高度。如何製作3個水平的,響應的背景圖像
HTML
<div class="row">
<div class="col-xs-4 col-md-4" style="margin:0 !important; padding:0 !important">
<a href="mysite">
<div class="casestudy-panel" style="background: url(myimage.jpg);"></div>
</a>
</div>
<div class="col-xs-4 col-md-4" style="margin:0 !important; padding:0 !important">
<a href="mysite">
<div class="casestudy-panel" style="background: url(myimage.jpg);"></div>
</a>
</div>
<div class="col-xs-4 col-md-4" style="margin:0 !important; padding:0 !important">
<a href="mysite">
<div class="casestudy-panel" style="background: url(myimage.jpg);"></div>
</a>
</div>
</div>
</div>
CSS
.casestudy-panel{
max-width:100%;
height: auto;
}
.casestudy-panel img {
max-width:100%;
height: 100%;
-webkit-background-size: cover !important;
-moz-background-size: cover!important;
background-size: cover!important;
-o-background-size: cover!important;
}
請發佈呈現的HTML,而不是PHP源代碼。另外,請考慮使用Stack Snippets功能(圖標看起來像帶尖括號的頁面)。 –
@MikeMcCaughan呈現html已啓用。提前致謝。 – rlm