我正在尝试将固定页脚中的文本与站点容器的左侧边缘对齐,而不是与页脚的左侧边缘对齐。页脚绝对定位在左侧和底部的0px。
这是我的Sass代码:
#neo_container {background: #000; width: 960px; height: 100%; margin: 0 auto; }
#neo_footer_container {
position: fixed;
bottom: 0px;
left: 0px;
height: 35px;
width: 100%;
z-index: 10000;
background: #666;
color: #FFF;
.neo_footertext{float: left; margin-right: 400px; font: 11pt Arial, Helvetica, sans-serif;} /* Formatting for copyright text in fixed footer */
.neo_footertext2{font: 11pt Arial, Helvetica, sans-serif;} /* Formatting for Neoscape text in fixed footer */
}可以在这里查看HTML和CSS:http://jsfiddle.net/maW8E/
发布于 2014-04-01 15:42:55
如果您不反对稍微修改HTML,您可以添加一个与您试图对齐的容器具有相同宽度的内部包装器。因此,您的页脚HTML看起来可能是(请注意在内容周围添加.inner-wrap:
<div id="neo_footer_container">
<div class="inner-wrap">
<p class="neo_footertext">469 SEVENTH AVE NEW YORK NY 10018 Privacy Policy | Legal Statement | Disclaimer</p>
<p class="neo_footertext2">Designed by Neoscape</p>
<!--Placeholder for 'Designed by Neoscape' logo-->
</div>
</div>然后,在.neo_footertext上删除这两种CSS样式。
#neo_wrapper .neo_container #neo_footer_container .neo_footertext {
float:left;
margin-right:400px;
}并将这些添加到样式.inner-wrap中
#neo_wrapper .neo_container #neo_footer_container .inner-wrap{
width:960px;
margin:0 auto;
}现在,您应该得到一个与#neo_wrapper相同宽度的内部容器,以#neo_footer_container为中心,因此您的页脚内容将保持与主内容包装器的边缘对齐。
下面是一个更新的JSFiddle来演示代码的工作原理。
希望这能有所帮助!如果你有任何问题,请告诉我。
发布于 2014-04-01 15:21:33
这里:移除浮子:左
.neo_footertext{
float: left; //Remove this
margin-right: 400px; // I would also remove this, unless you have a reason to put it in.
}https://stackoverflow.com/questions/22789979
复制相似问题