【发布时间】:2009-06-15 15:13:59
【问题描述】:
如果我有以下html:
<body>
<div id="mainTop">
</div>
<div id="main">
<h2>
<%= Html.Encode(ViewData["Message"]) %></h2>
<p>
To learn more about ASP.NET MVC visit
http://asp.net/mvc</a>.
</p>
</div>
<div id="mainBottom">
</div>
</body>
使用以下 CSS:
#mainTop
{
background: url('/Content/Images/bg_top.png') no-repeat;
width: 963px;
height: 65px;
margin: 0 auto;
text-align: left;
color: #5d676d;
}
#main
{
background: url('/Content/Images/bg_middle.png') repeat-y;
width: 963px;
min-height: 50px;
margin: 0 auto;
}
#mainBottom
{
background: url('/Content/Images/bg_bottom2.png') no-repeat;
width: 963px;
height: 128px;
margin: 0 auto;
}
看起来像这样:
为什么某些标签(如<p> 和标题标签会导致我的布局出现空白?理想情况下,我不希望我的内容之间有那些巨大的空间。
【问题讨论】:
-
您的 HTML/CSS 还有更多内容吗?我无法使用您的示例代码重现该问题。