表单元素完美垂直居中

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>表单元素完美垂直居中</title>
<style type="text/css">
*
{padding:0; margin:0;}
body
{font:14px/1.231 Tahoma, Geneva, sans-serif; background-color:#D1D5E7;}
label
{cursor:pointer; vertical-align:middle;}
input
{vertical-align:middle; margin:5px;}
.warp
{ margin:100px 350px;}
span
{ vertical-align:middle; text-decoration:underline;}
img
{ vertical-align:middle; border:1px solid #CCF;_margin-bottom:1px;}
p
{font-size:14px;}
h2
{font-size:16px;}
</style>
</head>

<body>
<div class="warp">
<h2>单选框和复选框面积很小,不容易点击,造成许多用户的困扰,用户体验不佳</h2>
<p>请看【一丝冰凉】的完美解决方案:<br />
完美垂直居中,点击文字可选,快捷键可选,鼠标在文字上显示手型(暗示可点击)</p>
<input name="aaa" id="aaa" type="checkbox" value=""/> <label for="aaa">X×我是完美的复选框</label> <br />
<input name="ccc" id="ccc" type="checkbox" accesskey="2" value=""/> <label for="ccc">我支持键盘 Alt+2选择(<span>2</span>)</label> <br />
<input name="bbb" id="bbb" type="radio" value=""/><label for="bbb">X×我是完美的单选框</label><br />
<label for="fff">X×我是完美的文本框</label><input id="fff" type="text"/><br />
<input name="eee" id="eee" type="checkbox" value=""/><span>图片也能居中</span><img width="270" height="129" usemap="#mp" src="http://www.baidu.com/img/baidu_sylogo1.gif"/>

</div>
</body>
</html>
posted @ 2011-11-10 08:11  lhgcore.J  阅读(2730)  评论(1编辑  收藏  举报