1、编写一个from表单
<form id="payment">
<fieldset>
<legend>用户详细资料</legend>
<ol>
<li>
<label for="name">用户名称:</label>
<input id="name" name="name" type="text" placeholder="请输入用户名" required autofocus>
</li>
<li>
<label for="email">邮件地址:</label>
<input id="email" name="email" type="email" placeholder="example@163.com" required>
</li>
<li>
<label for="phone">联系电话:</label>
<input id="phone" name="phone" type="tel" placeholder="010-12345678" required>
</li>
</ol>
</fieldset>
<fieldset>
<legend>家庭住址(收货地址):</legend>
<ol>
<li>
<label for="address">详细地址:</label>
<textarea id="address" name="address" rows="1" required></textarea>
</li>
<li>
<label for="postcode">邮政编码:</label>
<input id="postcode" name="postcode" type="text" required>
</li>
<li>
<label for="country">国家:</label>
<input id="country" name="country" type="text" required>
</li>
</ol>
</fieldset>
<fieldset>
<legend>付费方式</legend>
<ol>
<li>
<fieldset>
<legend>xyk类型</legend>
<ol>
<li>
<input id="visa" name="cardtype" type="radio">
<label for="visa">中国工商银行</label>
</li>
<li>
<input id="amex" name="cardtype" type="radio">
<label for="amex">中国人民银行</label>
</li>
<li>
<input id="mastercard" name="cardtype" type="radio">
<label for="mastercard">中国建设银行</label>
</li>
</ol>
</fieldset>
</li>
<li>
<label for="cardnumber">yhk号:</label>
<input id="cardnumber" name="cardnumber" type="number" required>
</li>
<li>
<label for="secure">验 证 码:</label>
<input id="secure" name="secure" type="number" required>
</li>
<li>
<label for="namecard">持 卡 人:</label>
<input id="namecard" name="namecard" type="text" placeholder="确定是否该卡用户!" required>
</li>
</ol>
</fieldset>
<fieldset>
<button type="submit">现在购买</button>
</fieldset>
</form>
2、编写css样式
<style type="text/css">
/*分别定义HTML中和标记之的距离样式*/
html, body, h1, form, fieldset, legend, ol, li {
margin: 0
padding: 0
}
/*定义<body>标记样式*/
body {
background: #ffffff
color: #111111
font-family: Georgia, "Times New Roman", Times, serif
padding-left: 20px
}
/*定义付费内容的样式*/
form#payment {
background: #9cbc2c
-webkit-border-radius: 5px
border-radius: 5px
padding: 20px
width: 400px
margin:auto
}
form#payment fieldset {
border: none
margin-bottom: 10px
}
form#payment fieldset:last-of-type { margin-bottom: 0}
form#payment legend {
color: #384313
font-size: 16px
font-weight: bold
padding-bottom: 10px
text-shadow: 0 1px 1px #c0d576
}
form#payment >fieldset >legend:before {
content: "Step " counter(fieldsets) ": "
counter-increment: fieldsets
}
form#payment fieldset fieldset legend {
color: #111111
font-size: 13px
font-weight: normal
padding-bottom: 0
}
form#payment ol li {
background: #b9cf6a
background: rgba(255, 255, 255, .3)
border-color: #e3ebc3
border-color: rgba(255, 255, 255, .6)
border-style: solid
border-width: 2px
-webkit-border-radius: 5px
line-height: 30px
list-style: none
padding: 5px 10px
margin-bottom: 2px
}
form#payment ol ol li {
background: none
border: none
float: left
}
form#payment label {
float: left
font-size: 13px
width: 110px
}
form#payment fieldset fieldset label {
background: none no-repeat left 50%
line-height: 20px
padding: 0 0 0 30px
width: auto
}
form#payment fieldset fieldset label:hover { cursor: pointer}
form#payment input:not([type=radio]), form#payment textarea {
background: #ffffff
border: #FC3 solid 1px
-webkit-border-radius: 3px
font: italic 13px Georgia, "Times New Roman", Times, serif
outline: none
padding: 5px
width: 200px
}
form#payment input:not([type=submit]):focus, form#payment textarea:focus {
background: #eaeaea
border: #F00 solid 1px
}
form#payment input[type=radio] {
float: left
margin-right: 5px
}
</style>
3、漂亮的表单生成。
这个是样例,不知道是不是你要的;
<!--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><meta http-equiv="Content-Type" content="text/html charset=GBK">
<title>模拟excel表格</title>
<style type="text/css">
<!--
.form th {
background-color: #efebde
border-right-width: 1px
border-bottom-width: 1px
border-right-style: solid
border-bottom-style: solid
border-right-color: #7e7d68
border-bottom-color: #7e7d68
font-weight: normal
padding-top: 5px
cursor:url(Cursors/SizeE.cur)
}
.form td {
border-right-width: 1px
border-bottom-width: 1px
border-top-style: none
border-right-style: solid
border-bottom-style: solid
border-left-style: none
border-right-color: #c0c0c0
border-bottom-color: #c0c0c0
cursor:url(Cursors/ColouredAero_ew.cur)
}
.cell {
cursor:url(Cursors/ColouredAero_prec.cur)
}
.form table {
border: 1px solid #7e7d68
}
.form input {
border-top-width: 0px
border-right-width: 0px
border-bottom-width: 0px
border-left-width: 0px
border-top-style: none
border-right-style: none
border-bottom-style: none
border-left-style: none
background-color: transparent
}
-->
</style>
</head>
<body>
<form action="" method="post" name="form1" class="form" id="form1">
<table width="80%" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<th width="10%" height="10%" scope="col">&nbsp</th>
<th width="10%" scope="col">A</th>
<th width="10%" scope="col">B</th>
<th width="10%" scope="col">C</th>
<th width="10%" scope="col">D</th>
<th width="10%" scope="col">E</th>
<th width="10%" scope="col">F</th>
<th width="10%" scope="col">G</th>
<th width="10%" scope="col">H</th>
<th width="10%" scope="col">I</th>
<th width="10%" scope="col">J</th>
</tr>
<tr>
<th height="10%" scope="row">1</th>
<td><input name="textfield112" type="text" class="cell" size="10"></td>
<td><input name="textfield11" type="text" class="cell" size="10"></td>
<td><input name="textfield52" type="text" class="cell" size="10"></td>
<td><input name="textfield54" type="text" class="cell" size="10"></td>
<td><input name="textfield56" type="text" class="cell" size="10"></td>
<td><input name="textfield61" type="text" class="cell" size="10"></td>
<td><input name="textfield69" type="text" class="cell" size="10"></td>
<td><input name="textfield77" type="text" class="cell" size="10"></td>
<td><input name="textfield85" type="text" class="cell" size="10"></td>
<td><input name="textfield93" type="text" class="cell" size="10"></td>
</tr>
<tr>
<th height="10%" scope="row">2</th>
<td><input name="textfield2" type="text" class="cell" size="10"></td>
<td><input name="textfield12" type="text" class="cell" size="10"></td>
<td><input name="textfield53" type="text" class="cell" size="10"></td>
<td><input name="textfield55" type="text" class="cell" size="10"></td>
<td><input name="textfield57" type="text" class="cell" size="10"></td>
<td><input name="textfield62" type="text" class="cell" size="10"></td>
<td><input name="textfield70" type="text" class="cell" size="10"></td>
<td><input name="textfield78" type="text" class="cell" size="10"></td>
<td><input name="textfield86" type="text" class="cell" size="10"></td>
<td><input name="textfield94" type="text" class="cell" size="10"></td>
</tr>
<tr>
<th height="10%" scope="row">3</th>
<td><input name="textfield3" type="text" class="cell" size="10"></td>
<td><input name="textfield13" type="text" class="cell" size="10"></td>
<td><input name="textfield28" type="text" class="cell" size="10"></td>
<td><input name="textfield29" type="text" class="cell" size="10"></td>
<td><input name="textfield58" type="text" class="cell" size="10"></td>
<td><input name="textfield63" type="text" class="cell" size="10"></td>
<td><input name="textfield71" type="text" class="cell" size="10"></td>
<td><input name="textfield79" type="text" class="cell" size="10"></td>
<td><input name="textfield87" type="text" class="cell" size="10"></td>
<td><input name="textfield95" type="text" class="cell" size="10"></td>
</tr>
<tr>
<th height="10%" scope="row">4</th>
<td><input name="textfield4" type="text" class="cell" size="10"></td>
<td><input name="textfield14" type="text" class="cell" size="10"></td>
<td><input name="textfield27" type="text" class="cell" size="10"></td>
<td><input name="textfield30" type="text" class="cell" size="10"></td>
<td><input name="textfield59" type="text" class="cell" size="10"></td>
<td><input name="textfield64" type="text" class="cell" size="10"></td>
<td><input name="textfield72" type="text" class="cell" size="10"></td>
<td><input name="textfield80" type="text" class="cell" size="10"></td>
<td><input name="textfield88" type="text" class="cell" size="10"></td>
<td><input name="textfield96" type="text" class="cell" size="10"></td>
</tr>
<tr>
<th height="10%" scope="row">5</th>
<td><input name="textfield5" type="text" class="cell" size="10"></td>
<td><input name="textfield15" type="text" class="cell" size="10"></td>
<td><input name="textfield26" type="text" class="cell" size="10"></td>
<td><input name="textfield31" type="text" class="cell" size="10"></td>
<td><input name="textfield60" type="text" class="cell" size="10"></td>
<td><input name="textfield65" type="text" class="cell" size="10"></td>
<td><input name="textfield73" type="text" class="cell" size="10"></td>
<td><input name="textfield81" type="text" class="cell" size="10"></td>
<td><input name="textfield89" type="text" class="cell" size="10"></td>
<td><input name="textfield97" type="text" class="cell" size="10"></td>
</tr>
<tr>
<th height="10%" scope="row">6</th>
<td><input name="textfield6" type="text" class="cell" size="10"></td>
<td><input name="textfield16" type="text" class="cell" size="10"></td>
<td><input name="textfield25" type="text" class="cell" size="10"></td>
<td><input name="textfield32" type="text" class="cell" size="10"></td>
<td><input name="textfield51" type="text" class="cell" size="10"></td>
<td><input name="textfield66" type="text" class="cell" size="10"></td>
<td><input name="textfield74" type="text" class="cell" size="10"></td>
<td><input name="textfield82" type="text" class="cell" size="10"></td>
<td><input name="textfield90" type="text" class="cell" size="10"></td>
<td><input name="textfield98" type="text" class="cell" size="10"></td>
</tr>
<tr>
<th height="10%" scope="row">7</th>
<td><input name="textfield7" type="text" class="cell" size="10"></td>
<td><input name="textfield17" type="text" class="cell" size="10"></td>
<td><input name="textfield24" type="text" class="cell" size="10"></td>
<td><input name="textfield33" type="text" class="cell" size="10"></td>
<td><input name="textfield50" type="text" class="cell" size="10"></td>
<td><input name="textfield67" type="text" class="cell" size="10"></td>
<td><input name="textfield75" type="text" class="cell" size="10"></td>
<td><input name="textfield83" type="text" class="cell" size="10"></td>
<td><input name="textfield91" type="text" class="cell" size="10"></td>
<td><input name="textfield99" type="text" class="cell" size="10"></td>
</tr>
<tr>
<th height="10%" scope="row">8</th>
<td><input name="textfield8" type="text" class="cell" size="10"></td>
<td><input name="textfield18" type="text" class="cell" size="10"></td>
<td><input name="textfield23" type="text" class="cell" size="10"></td>
<td><input name="textfield34" type="text" class="cell" size="10"></td>
<td><input name="textfield49" type="text" class="cell" size="10"></td>
<td><input name="textfield68" type="text" class="cell" size="10"></td>
<td><input name="textfield76" type="text" class="cell" size="10"></td>
<td><input name="textfield84" type="text" class="cell" size="10"></td>
<td><input name="textfield92" type="text" class="cell" size="10"></td>
<td><input name="textfield100" type="text" class="cell" size="10"></td>
</tr>
<tr>
<th height="10%" scope="row">9</th>
<td><input name="textfield9" type="text" class="cell" size="10"></td>
<td><input name="textfield19" type="text" class="cell" size="10"></td>
<td><input name="textfield22" type="text" class="cell" size="10"></td>
<td><input name="textfield35" type="text" class="cell" size="10"></td>
<td><input name="textfield48" type="text" class="cell" size="10"></td>
<td><input name="textfield47" type="text" class="cell" size="10"></td>
<td><input name="textfield46" type="text" class="cell" size="10"></td>
<td><input name="textfield45" type="text" class="cell" size="10"></td>
<td><input name="textfield44" type="text" class="cell" size="10"></td>
<td><input name="textfield43" type="text" class="cell" size="10"></td>
</tr>
<tr>
<th height="10%" scope="row">10</th>
<td><input name="textfield10" type="text" class="cell" size="10"></td>
<td><input name="textfield20" type="text" class="cell" size="10"></td>
<td><input name="textfield21" type="text" class="cell" size="10"></td>
<td><input name="textfield36" type="text" class="cell" size="10"></td>
<td><input name="textfield37" type="text" class="cell" size="10"></td>
<td><input name="textfield38" type="text" class="cell" size="10"></td>
<td><input name="textfield39" type="text" class="cell" size="10"></td>
<td><input name="textfield40" type="text" class="cell" size="10"></td>
<td><input name="textfield41" type="text" class="cell" size="10"></td>
<td><input name="textfield42" type="text" class="cell" size="10"></td>
</tr>
</tbody></table>
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</form>
</body></html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)