以前我是这样做的:
#navigation ul {
list-style: none;
padding: 0;
width:400px;
margin:auto;
text-align: center;
}
但不知何故,我的图像完全恢复到左侧。 这也只发生在 Firefox 而不是 safari!我该怎么办?
最佳答案
根据您的页面,您具有以下结构:
<div id="content" class="span-24 last">
<center><img src="front.jpg"></center>
</div>
首先你根本不需要 <center>
标签。其次,你需要在你的 CSS 上使用这个:
#content {
margin:auto;
margin-top:25px; /*to keep the value you have just for top*/
text-align:center;
}
关于html - CSS 代码帮助居中图像,但它以某种方式恢复到当前编码的左侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20380029/