宽度不定的多内容水平居中
html:
<div class='container'>
<div class='center-wrap'>
<span>内容一</span>
<span>内容二</span>
</div>
</div>
css:
.container{width:100%,text-align:center;}
.center-wrap{display:inline-block;}
.center-wrap span{display:block;float:left;margin:10px;padding:5px;}
核心思想:
父容器text-align:center,包裹:设为行内元素,内容:float排列