网页制作cnn6文章简介:表单元素input、文字完美垂直居中对齐方法.
像type=radio and type=checkbox的对齐问题,测试浏览器:ie7+/firefox8.0
原理:将font-family中的第一个字体设置verdana字体
测试代码如下:
<!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>表单元素input、文字完美垂直居中对齐方法-技术之家cnn6.net</title>
<style type="text/css">
body {font:12px/24px verdana;}
ul {list-style:none;}
input,label { vertical-align:middle;}
</style>
</head>
<body>
<ul>
<li><input type="radio" /><label>为受益人的合同</label></li>
<li><input type="checkbox" /><label>为受益人的合同</label></li>
<li><input type="radio" /><label>microsoft</label></li>
<li><input type="checkbox" /><label>microsoft</label></li>
</ul>
</body>
</html>
以上就是表单checkbox和radio文字对齐代码展示的详细内容。