2016-06-30 69 views
0

在bootstrap中,我可以使用class = img-responsive確保我的圖像完全顯示而不會被裁剪掉。我如何在我的CSS樣式表中實現這個「class = img-responsive」,以便我的背景圖像能夠完全顯示?帶CSS的Bootstrap背景圖像

這是我的HTML文件

<header class="bgimage"> 
    <div class="container"> 
    <h1>Headline</h1> 
    </div> 
</header> 

這是我的CSS樣式表。

.bgimage { 
    background-image: url('../images/tara1.jpg'); 
    background-position: center center; 
    background-size: cover; 
    height: 200px; 
} 

回答

0

我會嘗試以下方法:設置一個寬度

.bgimage{ 
    background-image: url('../images/tara1.jpg'); 
    background-size:100% 100%; 
    background-repeat: no-repeat; 
    height: 200px; 
} 

想,否則我認爲這一比例將不工作:)