Neil的备忘录

just do it
posts - 66, comments - 8, trackbacks - 0, articles - 0

CSS 按钮 垂直居中

Posted on 2010-04-21 11:33 Neil's NoteBook 阅读(2322) 评论(2)  编辑  收藏
DIV中 包含按钮,实现按钮垂直居中的原理是:定义按钮的高度,然后设置按钮的margin,把DIV撑开后按钮就处于垂直居中的位置了
<div style="margin: 0px auto 0px auto; background-color: pink; text-align:center; width: 200px;">
       
<input type="button" value="测试按钮" style="height: 20px;  margin-top: 90px; margin-bottom: 90px;" />
  
</div>

Feedback

# 4中  回复  更多评论   

2010-11-01 21:30 by 3116
C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\Content.IE5\UVCFCZ0J\JpegImage[1].jpg

# re: CSS 按钮 垂直居中[未登录]  回复  更多评论   

2012-08-30 15:53 by 1
没有做到上下居中兼容

只有注册用户登录后才能发表评论。


网站导航: