【发布时间】:2012-11-25 16:35:43
【问题描述】:
这是一个简单的问题,但我正在努力获得准确的输出。我需要在页脚的 div 中对齐 3 个 div。我在谷歌尝试了很多,以前也工作过。但在页脚固定位置它不完全工作。
在该图像中,白色容器 div 用于页脚、左红、右绿和居中。
这是我的 CSS :
div .footer-container
{
height:53px;
width:100%;
position:fixed;
}
div .footer-container div .footer-left
{
background-color:#f00;
float:left;
width:33%;
height:31px;
}
div .footer-container div .footer-right
{
background-color:#0f0;
float:right;
width:33%;
height:31px;
}
div .footer-container div .footer-center
{
background-color:#f0f;
margin:0 auto;
height:31px;
width:33%;
}
这里是 HTML:
<div data-role = "footer" class="footer-container">
<div>
<div class="footer-left"></div>
<div class="footer-right"></div>
<div class="footer-center"></div>
</div>
</div>
做错了什么?请解释一下。
【问题讨论】:
-
你能张贴标记吗?我看到它就像你的形象:jsfiddle.net/ap6EG
-
是的,这就是我寻求帮助的原因:-(
-
只需将 .footer-center 作为第一个孩子 ;)
-
只是为了确定,您正在尝试完成图像的外观?