這裏是我的fiddle,當我最小化窗口時,標題的高度設置爲最小高度:80px,因爲它在響應那裏是標題圖像下方的空白區域,有沒有添加最小高度的任何方法,標題高度應該自動調整?由於最小高度不正確的頭圖像,我們可以通過jQuery或其他方式修復它
注:爲什麼我加分高的原因:80px到標題,因爲在我的CSS所有的包裝都在固定的位置
HTML -
<div class="wrapper">
<header class="header">
<img src="http://www.emedicalpoint.com/images/nav/sprite.jpg" alt="">
</header>
<div class="content">
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
</div>
<footer>
footer content here
</footer>
</div>
CSS -
img {
width: 100%;
}
.wrapper {
bottom: 0;
height: 100%;
position: fixed;
top: 0;
width: 100%;
}
header {
background: yellow none repeat scroll 0 0;
height: 80px;
min-height: 80px;
width: 100%;
}
.content {
bottom: 40px;
position: fixed;
top: 80px;
width: 100%;
}
footer {
background: #414141 none repeat scroll 0 0;
bottom: 0;
color: #fff;
height: 40px;
position: fixed;
width: 100%;
}
實際上,@medard如果你看到下面的html,那麼header後面的所有元素都處於固定的位置,例如.-content類是一個固定的位置,你知道我們必須提到一個top:xyz數字。這就是我給高度頭的原因。讓我們假設我刪除了解決我的問題的頭部高度,但是如何將該位置放置在其位置 –
我想說的是我會爲了實現具有固定像素值的響應性而使用diffucult。除非你準備做大量的@media查詢,這不會是prettry。你將不得不使用百分比以及下面的.content div。我已經編輯了我的答案。 – Medard
我明白了你的觀點,但即使我改變我的CSS,並使其成爲百分比,而不是像素。但是,當我設置 ' header img {height}:100%; 寬度:100%; }' 標題圖片變得可調整 –