2015-04-19 73 views
0

我在最新版本中使用引導程序3 - 3.3.4 - 不幸的是.img-responsive類無法正常工作。 我嘗試了一切,甚至.col-md-12連同.img-responsive一無所有。img-resposive不起作用

HTML:

<header class="container" id="container"> 
    <div class="row"> 
    <section class="col-md-3"> 
     <a href="#"> 
      <img class="img-responsive" src="http://placehold.it/350x150" alt="..." /> 
     </a> 
    </section> 
    <section class="col-md-9"> 
     <p>something else...</p> 
    </section> 
    </div> 
</header> 

CSS:

#container { 
    height: 60px; 
    background-color: red; 
} 

你可以看到實時預覽here

@edit

的圖像是在容器 - 紅色部分 - 這是此問題的原因,.img-responsive本來是要調整圖像大小,使其適合,但事實並非如此。

回答

0

刪除height: 60px;

你只需要:

#container {  
    background-color: red; 
} 

圖像上有高度爲150px,但#container的具有60像素。

+0

但是大小必須是60%,是不是'.img-responsive'應該調整圖像的大小? – yayuj

+0

在這種情況下,您不需要響應式網站。您可以設置.img-responsive使其具有高度:60px。 –

+0

我明白了,謝謝。 – yayuj