Div高度搞砸了

时间:2012-11-10 17:13:39

标签: css html

这是我之前没有经历过的事情,我的div高度不合作CSS&正在抛弃页面的整个流程。 div应该是居中的,960px宽,大约1000px高度&底部有150px的填充物,可以将它与我的页脚分开。

网站链接: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;
}

非常感谢你的帮助。

3 个答案:

答案 0 :(得分:2)

我看了你的css来源,你的html中有一个.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>

我在你的任何一个css中看不到energyrating-desc

编辑:

以防万一,你也没有在你的任何一个css中指定energyrating-desc ....

答案 1 :(得分:0)

通过指定适当的保证金使你的div在中心。

margin:0 auto;

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

答案 2 :(得分:-1)

我查看了开发人员工具中的跟踪样式面板,没有应用于div元素的样式属性。另外我没有在网站的css文件中找到任何名为“energyrating-desc”的样式ID?!你在哪里定义它?毕竟,我发现"energy.php"的html响应包含多个"html"标记和不正确的结构。在查找css样式中的错误之前,您必须先执行此操作。

html文档必须有一个名为"html"的根标记,其中一个标记为"body",如果需要,还有一个名为"head"的标记,用于包含css资源和元标记或客户端脚本。即使是一个不正确的标签(未封闭,写得不好......)也会导致许多你从未见过的令人难以置信的布局。

干杯