Posted on 2010-04-21 11:33
Neil's NoteBook 閱讀(2335)
評(píng)論(2) 編輯 收藏
DIV中 包含按鈕,實(shí)現(xiàn)按鈕垂直居中的原理是:定義按鈕的高度,然后設(shè)置按鈕的margin,把DIV撐開(kāi)后按鈕就處于垂直居中的位置了
<div style="margin: 0px auto 0px auto; background-color: pink; text-align:center; width: 200px;">
<input type="button" value="測(cè)試按鈕" style="height: 20px; margin-top: 90px; margin-bottom: 90px;" />
</div>