罗艾淋 - 2008-4-10 21:32:24
CSS:
body{font-size:12px; line-height:1.9; text-align:center;}
#info{border:1px solid #006699; background:#F9EBBB; text-align:left; margin:10px auto; width:300px; padding:10px 10px 10px 110px;}
#info label{ width:100px;display: block; float:left; text-align:right; margin-left:-100px!important; margin-left:-50px;}
#info input{ border:1px solid #666699;height:19px;}
#info h1{font-size:12px; margin:0px;}
#info em{color:#FF0000; padding:0 5px;}
#info div{color:#FF0000; border:1px solid #FF0000; padding:0 5px; background:#FCF9E2; margin:2px 0;width:140px;}
.bx{ margin:3px;}
HTML:
<div id="info">
<h1>表单布局的一个测试</h1>
<label>您的名字:</label>
<input name="" type="text" />
<em>*</em>这是必需要填写的!<br />
<label></label>
<div>用户名不合法!</div>
<label>电子邮件:</label>
<input name="" type="text" />
<em>*</em>这是必需要填写的!<br />
<label></label>
<div>电子邮件错误!</div>
<label>地址:</label>
<input name="" type="text" />
<em>*</em>这是必需要填写的!<br />
<label>网址:</label>
<input name="" type="text" />
<em>*</em>这是必需要填写的!<br />
<input type="button" class="bx" value="提交" />
</div>
运行效果:
<!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> /*zishu.cn*/ body{font-size:12px; line-height:1.9; text-align:center;} #info{border:1px solid #006699; background:#F9EBBB; text-align:left; margin:10px auto; width:300px; padding:10px 10px 10px 110px;} #info label{ width:100px;display: block; float:left; text-align:right; margin-left:-100px!important; margin-left:-50px;} #info input{ border:1px solid #666699;height:19px;} #info h1{font-size:12px; margin:0px;} #info em{color:#FF0000; padding:0 5px;} #info div{color:#FF0000; border:1px solid #FF0000; padding:0 5px; background:#FCF9E2; margin:2px 0;width:140px;} .bx{ margin:3px;} </style> </head> <body> <div id="info"> <h1>表单布局的一个测试</h1> <label>您的名字:</label> <input name="" type="text" /> <em>*</em>这是必需要填写的!<br /> <label></label> <div>用户名不合法!</div> <label>电子邮件:</label> <input name="" type="text" /> <em>*</em>这是必需要填写的!<br /> <label></label> <div>电子邮件错误!</div> <label>地址:</label> <input name="" type="text" /> <em>*</em>这是必需要填写的!<br /> <label>网址:</label> <input name="" type="text" /> <em>*</em>这是必需要填写的!<br /> <input type="button" class="bx" value="提交" /> </div> </body> </html>