2014-05-20 18 views
0

我想製作15%高度的頁眉和頁腳,其餘高度應爲主要(帶圖片)。但不幸的是,圖像太大了,我不知道如何調整它的寬度(#all div)和70%(#all div)的100%。CSS |無法將圖片放入主內容中

希望有任何幫助。

image現在看起來如何。

html, 
body { 
    margin:0; 
    padding:0; 
    height:100%; 
    width: 100%; 
} 

#all { 
    position:relative; 
    width: 60%; 
    height:100%; 
    margin: auto; 
} 

header#main-header{ 
    display: block; 
    position: absolute; 
    background:#ff0; 
    height: 15%; 
    width: 100%; 
    z-index: 10; 
} 

#main { 
    display: block; 
    position: absolute; 
    top: 15%; 
    height: 30%; 
} 

footer{ 
    display: block; 
    position:absolute; 
    bottom:0; 
    width:100%; 
    height:15%; /* Height of the footer */ 
    background:#6cf; 
    z-index: 10; 
} 
+0

您不應該使用百分比來指定頁眉和頁腳元素的高度,事實上,您根本不需要指定高度。只需在頁眉和頁腳內的內容上使用邊距/填充來設置高度。 – APAD1

+1

請分享您的HTML以便我們回答問題。 – TylerH

+0

添加了php文件(WordPress) – Zyngi

回答

0

嘗試使用#main img {display:block; width:100% } 另外,我建議你使用類而不是ID。