我知道这个问题已经被问过很多次了。
将 div 居中对齐 https://stackoverflow.com/questions/1740587/float-a-div-to-center
不过,我遵循他们的建议:
<center>
<div style="margin : auto; text-align: center">
<a href="#" style="float: left; margin-right: 10px;">Menu Item 1</a>
<a href="#" style="float: left; margin-right: 10px;">Menu Item 2</a>
<a href="#" style="float: left; margin-right: 10px;">Menu Item 3</a>
</div>
</center>
(source: google.com http://sites.google.com/site/yanchengcheok/Home/a.png)
通过使用“居中”和“自动边距”、“文本对齐中心”...我仍然无法将菜单项居中。
使用内联块而不是左浮动。
<center>
<div style="margin : auto; text-align: center">
<a href="#" style="display: -moz-inline-box; display: inline-block; left; margin-right: 10px;">Menu Item 1</a>
<a href="#" style="display: -moz-inline-box; display: inline-block; margin-right: 10px;">Menu Item 2</a>
<a href="#" style="display: -moz-inline-box; display: inline-block; margin-right: 10px;">Menu Item 3</a>
</div>
</center>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)