在我的标记中,我希望页脚底部边距为 25 像素。我这样做了:
div.footer {
margin-bottom: 25px;
}
没有成功——就没有底边距。如果我这样做:
div.footer {
margin-bottom: 25px;
float: left;
}
有用!
我知道!我可以用浮动来解决问题,但这是一个好习惯吗?有没有别的办法?
提前致谢。
== 更新!/ 我的一小段代码 ==
CSS:
div.rlside-margin {
margin: 0 25px;
}
div.tpside-margin {
margin: 25px 0;
}
div.allside-margin {
margin: 25px;
}
div.max-width {
width: 60em;
margin: 0 auto;
}
div.header {
background-color: #efefef;
width: 100%;
height: 90px;
}
div.post-header {
background-image: url("/Images/PostHeader_Background.jpg");
width: 960px;
height: 50px;
}
div.content {
position: relative;
}
div.footer {
margin-bottom: 25px;
}
HTML:
<div class="header">
<div class="max-width">
<a href="@Url.Action("Index", "Home")" class="logo float-left"></a>
<ul class="navigation float-right">
<li><a href="@Url.Action("Index", "Home")" rel="Home">Home</a></li>
<li><a href="@Url.Action("Index", "Sobre")">Sobre</a></li>
<li><a href="@Url.Action("Index", "Contato")">Fale conosco</a></li>
</ul>
</div>
</div>
<div class="max-width">
<div class="post-header">
<ul class="options float-left">
<li><a href="#"><span>Ofertas</span></a></li>
<li><a href="#"><span>Lista de compras (0)</span></a></li>
</ul>
<div class="search-bar float-right">
<form>
<input class="float-left" type="text" placeholder="Por qual produto você procura? Digite aqui" />
<button class="magnifier"></button>
</form>
</div>
</div>
</div>
<div class="content">
@RenderBody()
</div>
<div class="max-width">
<div class="footer">
<div class="tbside-margin">
<hr />
<ul class="bottom-navigation">
<li><a href="@Url.Action("Index", "Home")" rel="Home">Home</a></li>
<li><a href="@Url.Action("Index", "Sobre")">Sobre</a></li>
<li><a href="@Url.Action("Index", "Contato")">Fale conosco</a></li>
</ul>
</div>
</div>
</div>