日期:2014-05-17  浏览次数:20576 次

css背景自适应文字宽度按钮
a.bt_1,a.bt_2{ margin:0 3px; cursor:pointer; font-weight:normal; font-size:12px; text-decoration:none}
a.bt_1,a.bt_1 span,a.bt_1:hover,a.bt_1:hover span,a.bt_2,a.bt_2 span,a.bt_2:hover,a.bt_2:hover span{ background:url(../images/bt_1.gif) no-repeat top left; padding-left:15px; height:24px; display:inline-block; text-indent:0; line-height:23px; color:#FFF;}
a.bt_2,a.bt_2 span,a.bt_2:hover,a.bt_2:hover span{ background:url(../images/bt_2.gif) no-repeat top left; color:#000;}

a.bt_1 span,a.bt_2 span,a.handle_bt span{background-position:top right; padding:0; padding-right:12px;}
a.bt_1:hover,a.bt_2:hover,a.handle_bt:hover{background-position:bottom left; text-decoration:none; color:#000000;}
a.bt_1:hover span,a.bt_2:hover span,a.handle_bt:hover span{background-position:bottom right; padding:0; padding-right:12px;}

以下是引用的代码,用a标签代替按钮

<A class="bt_1" href="#"><SPAN>确认</SPAN></A>
<A class="bt_2" href="#"><SPAN>取消</SPAN></A>

?