我目前遇到网站页脚的问题。
当以 100% 大小(正常大小)处理时,页脚对齐得很好。但是,当我调整它的大小时,它完全不对齐并位于左侧,它需要保持居中。
屏幕截图:
相关 CSS:
/* Dark blue area above the main part of the footer, stays aligned */
#footerUpper {
clear: left;
width: 100%;
vertical-align: top;
background-color: #252B76;
text-align: center;
color: #FFFFFF;
margin-top: 30px;
/* padding: 5px;*/
}
#footerUpper ul {
padding: 0;
margin: 25px 0px;
list-style: none;
}
#footerUpper li {
display: inline;
padding: 0 52px;
font-size: 14px;
font-weight: bold;
}
#footerUpper li a {
text-decoration: none;
color: #FFFFFF;
}
/* Main part of the footer */
#footer {
float: left;
width: 100%;
color: #252B76;
background-color: #89B0F1;
padding: 5px;
}
/* Table within the footer */
#footerTable {
width: 980px;
margin-left: 150px;
}
谢谢。
最佳答案
如果没有看到更多的代码或它的工作示例,很难对问题出在哪里有太多的了解。
但我认为一个解决方案可能是在内部内容上设置一个静态宽度,例如内容本身未对齐,我认为这是你的“footerTable”——应用“margin:0 auto”它居中对齐,这是假设它的父级是 100% 宽度,我相信它是。此外,删除适用于它的任何其他 margin 规则。
关于html - 放大/缩小时页脚未对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17042486/