2015-10-17 45 views
1

我在頁面上的頁腳出現了一些問題。我有一個主要的包裝在頁面居中,與height: auto;,使包裝將擴大,因爲我添加內容。迄今爲止它一直在努力。我添加了標題,導航和內容,但由於某種原因,只要添加了頁腳,頁腳就根本不會顯示出來。我嘗試clear: both;有人說,我試過:我的頁面頁腳隱藏在頁面上,而且我已嘗試了所有內容

position: absolute; 
bottom: 0; 

這也沒有工作。我對前端很陌生;我只是學習它來製作我的投資組合。我通常不會做任何前端開發。我希望將頁腳保留在主包裝中並讓它顯示出來。謝謝你的時間。

這裏是我的HTML:http://pastebin.com/U9ZZFJsk
這裏是我的CSS:http://pastebin.com/3N7TX1B1

+0

y你是否在任何地方都使用絕對位置。 –

+0

檢查我的答案。它有一個工作小提琴。如果它不起作用,它會幫助您創建小提琴和共享,以便它可以在線修復。 –

回答

1

請勿使用絕對位置。做這3個變化,它應該工作正常。這將根據屏幕margin:auto

#wrapper { 
    width: 80%; 
    opacity: 0.8; 
    margin: auto; 
    overflow: hidden; 
} 

#content { 
    padding: 3.5em 4em; 
    width: 100%; 
    background-color: #CCCCCC; 
} 

#footer { 
    width: 100%; 
    clear: left; 
    height: 4em; 
    background-color: black; 
    color: white; 
} 
+1

對不起,延遲迴復!這解決了我的問題。非常感謝! –

+0

不用客氣 –

1

改變內容的位置相對

#content { 
    position: relative; 
    padding: 3.5em 4em; 
    width: 100%; 
    height: auto; 
    background-color: #CCCCCC; 
} 
1

請更改內容DIV + CSS像下面 -

#content { 
    background-color: #cccccc; 
    clear: both; 
    height: auto; 
    padding: 3.5em 4em; 
    position: relative; 
    width: 100%; 
} 

我認爲這會緩解你的問題。

0

這是給你的工作小提琴的大小自動居中。

http://jsfiddle.net/ztcafcqa/

基本上,這個問題是有可能與你使用絕對的#內容類。我已經移除了絕對位置。

#content { 
    padding: 3.5em 4em; 
    width: 100%; 
    height: auto; 
    background-color: #CCCCCC; 
} 
相關問題