在我的网站上,我有一个位置固定的页脚,我想在其中放置居中的文本。 奇怪的是,无论我做什么,文本都不会居中,而是总是在左边。
<div id="footer">
Copyright 2013 © LolStreamGallery - <a href="TermsofUse.html">Terms of Use</a>
</div>
CSS:
#footer {
text-align:center;
position:fixed;
bottom:0px;
height:30px;
background-color:#ededed;
font-family: "Myriad Pro";
font-size:14px;
}
也许你还想知道 Body 的 CSS:
body {
background-color:#ededed;
/*text-align:left;*/
margin:0;
padding:0px;
}
如您所见,我已经尝试取消注释 body 默认对齐方式,但没有效果。 有人有想法吗?
最佳答案
改成这样:
#footer {
text-align:center;
position:fixed;
bottom:0px;
height:30px;
background-color:#ededed;
font-family: "Myriad Pro";
font-size:14px;
width:100%; // added
}
关于html - 文本对齐中心不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14163201/