2012-11-10 69 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; 
}