2012-11-10 64 views
0

這是我以前沒有經歷過的事情,我的div高度不合作在CSS &正在拋出一個頁面的整個流程。該div應該居中,960像素寬,約1000像素高& 150px的填充底部將其與頁腳分開。Div高度被搞砸

網站鏈接:http://tinyurl.com/b8vvhgr

HTML

<div id="energyrating-desc"> 

<h1><span class="gray">Energy Audit Services</span></h2> 

<img src="/nd/images/yellow-bar.jpg" width="960" height="2" style="padding-bottom:2px;"></img> 

<p>According to the EPA Energy Star program, the average American household spends $1,500 annually on 
energy bills - a number that may go up as much as 50% this year. 
</p> 

<br> 

<p>Almost half of that energy goes to heating and cooling your home. Lighting and appliances represent about a 
quarter of those costs. Each of us can take action today to reduce energy use at home, while still staying 
comfortable. 
</p> 


<br> 

<p>Let New Day Homes perform a top-to-bottom Energy Audit of your home to help determine the cause of any 
problems you may be experiencing, help you gauge your home's energy efficiency, and recommend clear 
steps you can take to reduce your energy bills.</p> 

<br> 

<p><b>Energy Audit</b></p> 
<p> 
Find out where you can save on energy costs by having a full energy audit done on your home. 
</p> 

<br> 

<p><b>New home Certified Energy Ratings</b></p> 
<p> 
Performed for builders and home buyers. 
</p> 

<br> 

<p><b>Ratings for Builder Tax Credit</b></p> 

<br> 

<p><b>Energy STAR Ratings</b></p> 

<br> 

<p><b>IECC-2009 Testing</b></p> 
<p> 
Blower door testing, insulation inspections, and pre-verification to meet the IECC-2009 
Energy Code requirements. 
</p> 



</div> 

CSS

/*Energy Description*/ 

#energyrating-desc {  
    padding-bottom: 150px; 
    width: 960px; 
    height: 670px; 
    margin-left: auto; 
    margin-right: auto; 
} 

我非常感謝你的幫助。

+0

您發佈正確的CSS - 但它不是任何地方在您的網站。 –

+0

你的答案是你的CSS,但你已經定義它沒有在你的css – defau1t

+0

得到了問題修復,謝謝你們 - 我的一部分愚蠢的錯誤。 – Willard

回答

2

我參加了你的CSS源一看,你有一個html closeing標籤在你.css看看

body { 
    /*background: url(/nd/images/bgtop.png), url(/nd/images/bg.jpg); 
    background: url(/nd/images/bgtop.jpg)\9; /* IE 8 and below */ 
    background-repeat: repeat-x\9; /* IE 8 and below */ 
    background-repeat: repeat-x, repeat;*/ 
    color: #000000; 
    font-size:14px; 
    font-family: sans-serif; 
} 

</body> 

刪除

</body> 

和我沒有看到energyrating-desc在你的任何css

編輯:

太以防萬一經過與螢火蟲,你沒有指定任何你的CSS的energyrating-desc ....

+0

謝謝你的答覆 - 我注意到你們提到CSS中沒有「energyrating-desc」,但我創建了一個帶有該名稱的div id,這是不正確的嗎? – Willard

+0

知道它固定 - nvm,愚蠢的錯誤(我忘了更新我的樣式表中的.css路徑)。 再次感謝。 – Willard

+0

現在它沒關係,我在你的CSS中看到它,並且當你編碼很多時,不用擔心有時候會發生這樣的事情:)給你一個問題upvote,我討厭當某人因爲錯誤而投票某人時他們可能會做的事如果我能夠提供幫助,我很高興,在未來的代碼運氣好運 –

0

我回顧了開發人員工具中的跟蹤樣式面板,沒有將樣式屬性應用於div元素。此外,我沒有在網站的css文件中找到任何名爲「energyrating-desc」的樣式ID?!你在哪裏定義它?畢竟,我發現"energy.php"的html響應有多個"html"標籤和一個不正確的結構。在查找css樣式中的錯誤之前,您必須先執行該操作。

HTML文檔必須有一個名爲"html"一個根標籤,一個標籤裏面命名爲"body",如果你需要的話,一個標籤命名爲"head"包括CSS資源和meta標籤或客戶端腳本。即使一個不正確的標籤(未封閉,錯誤書寫和...)也會導致你從未見過的許多令人難以置信的佈局。

乾杯

+0

謝謝主席的回覆 – Willard

+0

乾杯,但我不知道誰投了我票。正如我的經驗所說,你的問題的大部分是HTML文件,沒有別的。 ;) – Rikki

+0

你得到了一個投票(不是來自我),因爲破折號與這種情況無關...... –

0

通過分配適當的邊距使您的div在中心。

margin:0 auto; 

#energyrating-desc {  
    padding-bottom: 150px; 
    width: 960px; 
    height: 670px; 
    margin:0 auto; 
}