我設計了一個提交按鈕並希望將其居中。這裏是CSS:居中提交按鈕div
.outer {
text-align: center;
}
/* BUTTONS */
.buttons button{
cursor: pointer;
cursor: hand;
border: 0;
height: 28px;
float: left;
text-indent: 4px;
text-decoration:none;
font-weight: bold;
text-transform: uppercase;
font-size: 1.2em;
background: url(../images/button.png);
}
.buttons span{ /* Right-hand corner */
cursor: pointer;
cursor: hand;
display: block;
width: 5px;
height: 28px;
float: left;
background: url(../images/button.png) top right;
}
下面是HTML:
<div class="outer">
<div class="buttons">
<button type="submit">SUBMIT</button><span></span>
</div>
</div>
我從http://www.scottking.com.au/blog/2009/03/custom-styled-css-html-input-buttons/#.Uc2IYdjcAix
到目前爲止一直未能中心對齊此按鈕複製該代碼。
通過中心對齊,你的意思是按鈕的文本,或者它的父容器中的按鈕本身? – crush
你可以做'.outer .buttons {display:inline-block; }' –