我需要創建一個網站,該網站將始終填滿屏幕,因此我使用百分比。無法獲取元素與基於百分比的值排列
我在上面放置了一個固定的header
的10%
高度。並且section
我給出10%
的margin-top
。人們會認爲他們會相互衝突,但事實並非如此。會有人想幫忙嗎?
我有以下HTML:
<header></header>
<section></section>
與挺的筆直向前一塊的CSS:
html, body {
height:100%;
}
header, section {
width:100%;
}
header {
height:10%;
background:red;
position:fixed;
top:0;
left:0;
}
section {
background: blue;
height:90%;
margin-top:10%;
}
你可以看到這個活在http://jsfiddle.net/DanielApt/SeJfu/。