<!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">
<html>
<head>
<title>css构造表单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type = "text/css">
label
{
display:block;
}
</style>
</head>
<body>
<!-- label标签的使用 -->
<form>
<label for = "username">用户名:<input type = "text" id = "username" name = "username" /></label>
性别:<label for = "sex1"><input type = "radio" value = "男" id = "sex1" name = "sex" />男</label>
<label for = "sex2"><input type = "radio" value = "女" id = "sex2" name = "sex" />女</label>
</form>
</body>
</html>
<!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">
<html>
<head>
<title>css构造表单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type = "text/css">
body
{
}
input,textarea
{
border:3px double black;
}
</style>
</head>
<body>
<form>
<!-- 给文本框添加漂亮边框 -->
<input type = "text" />
<textarea cols = "20" rows = "9">
</textarea>
</form>
</body>
</html>
<!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">
<html>
<head>
<title>css构造表单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type = "text/css">
body
{
}
select option.a
{
background:green;
}
select option.b
{
background:red;
}
select option.c
{
background:blue;
}
</style>
</head>
<body>
<form>
<!-- 给下拉菜单设置背景 -->
<select>
<option class = "a">上海</option>
<option class = "b">盐城</option>
<option class = "c">北京</option>
</select>
</form>
</body>
</html>
<!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">
<html>
<head>
<title>css构造表单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type = "text/css">
body
{
}
textarea
{
width:300px;
height:150px;
scrollbar-face-color:#333;
scrollbar-highlight-color:#666;
scrollbar-shadow-color:red;
scrollbar-3dlight-color:#999
scrollbar-arrow-color:#999;
scrollbar-track-color:#999;
scrollbar-darkshadow-color:#000;
}
</style>
</head>
<body>
<form>
<!-- 给文本区设置滚动条 -->
<textarea>
</textarea>
</form>
</body>
</html>
<!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">
<html>
<head>
<title>css构造表单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type = "text/css">
fieldset
{
margin:20px;
padding:10px;
}
legend
{
background-color:#ddd;
padding:5px;
border-width:1px;
border-style:solid;
border-color:#fff #aaa #666 #fff;
}
</style>
</head>
<body>
<form>
<!-- 表单外边框设置fieldset legend -->
<fieldset>
<legend>登录信息</legend>
</fieldset>
</form>
</body>
</html>
<!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>
<title>css构造表单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type = "text/css">
label
{
background:yellow;
<!-- 测试无效,待以后解决 -->
width:120px;
text-align:right;
float:left;
}
</style>
</head>
<body>
<!-- 结构化布局表单 -->
<form id = "regForm">
<fieldset>
<legend>登录信息</legend>
<div class = "dataArea frist">
<label for = "username">用户名:</label><input type = "text" id = "username" class = "input" />
</div>
<div class = "dataArea">
<label for = "password">密码:</label><input type = "password" id = "password" class = "input" />
</div>
<div class = "dataArea">
<label for = "passwordVerify">确认密码:</label><input type = "password" id = "passwordVerify" class = "input" />
</div>
</fieldset>
<fieldset>
<legend>个人信息</legend>
<div class = "dataArea frist">
<label for = "nickname">昵称:</label><input type = "text" id = "nickname" class = "input" />
</div>
<div class = "dataArea">
<label for = "email" class = "hint">电子邮件:</label><input type = "text" id = "email" class = "input" />
</div>
<div class = "subArea">
<input type = "submit" value = "注册" class = "input" />
<input type = "button" value = "返回" class = "input" />
</div>
</fieldset>
</form>
</body>
</html>