【发布时间】:2017-01-26 15:01:29
【问题描述】:
我无法使用 text-align 或 margin:auto 使页脚居中。小文本也不行。
我是 HTML 和 CSS 的新手,因此非常感谢任何帮助 :)
代码:
/* Footer */
footer {
text-align: center;
font-size: 0.7em;
border-top: 1px dotted #E8DFAC;
padding-top: 1em;
margin: 0 auto;
}
footer a,
footer a:visited {
color: #636363;
}
footer a:hover,
footer a:focus {
color: green;
}
<!-- Footer -->
<footer>
<small>Made by Hannah Hawkins</small>
</footer>
::: 更新 ::: 我发现我可以使用页脚标签中的样式属性来修复它。谢谢!
【问题讨论】:
-
这里似乎工作正常...尝试在您的应用中为
footer添加宽度 100%... -
@kukkuz 绝对。她只需要声明页脚的 with。
-
我尝试添加 (margin: auto 0) 和 (width: 100%),但它仍然无法在 Chrome 中正确显示。我的 CSS 样式表的其他部分也开始出现类似问题。
标签: html css margin footer text-align