-1

这是我以前没有经历过的事情,我的 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;
}

我非常感谢您的帮助。

4

3 回答 3

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>

energyrating-desc在你的任何 CSS 中都没有看到

编辑:

也检查了萤火虫以防万一,你没有energyrating-desc在你的任何 css 中指定......

于 2012-11-10T17:19:48.387 回答
0

通过分配适当的边距使您的 div 居中。

margin:0 auto;

#energyrating-desc {    
    padding-bottom: 150px;
    width: 960px;
    height: 670px;
    margin:0 auto;
}
于 2012-11-10T17:18:33.493 回答
-1

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

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

干杯

于 2012-11-10T17:17:12.647 回答