所以我有一个div,它将包含3个按钮,我希望这些按钮在div中居中.
到目前为止我试过这个
.centerButtons
{
margin-left: auto;
margin-right: auto;
width: 90%;
}
Run Code Online (Sandbox Code Playgroud)
其中包含按钮的div很好,但是这个div中的实际按钮没有居中..这是我到目前为止的标记..
<div class="clearfixLeft clearfix centerButtons">
<xsl:if test="sc:fld('Link One', .)!=''">
<div class="fl_left mr_7 mt_10">
<div class="green-btn-solid">
<sc:link field="Link One">
<span class="btnspan">
<sc:text select="." field="Link One Text" />
</span>
</sc:link>
</div>
</div>
</xsl:if>
...
</div>
Run Code Online (Sandbox Code Playgroud)
附加类
/* link styles */
.green-btn-solid {line-height: 21px; height: 21px; background: url(../../images/SOURCE/btn_grn_r.gif) 100% 0 no-repeat; width: auto; display: block; padding-right: 30px; }
.green-btn-solid span {display: block; float: left; background: url(../../images/SOURCE/btn_grn_l.gif) 0 0 no-repeat; line-height: 21px; height: 21px; padding-left: 12px; color: #fff;}
Run Code Online (Sandbox Code Playgroud)
使用 text-align
.centerButtons {
text-align: center;
}
Run Code Online (Sandbox Code Playgroud)
这将使所有内联的儿童上课 centerButtons