创建一个表格,使用类选择器来美化表格样式:
代码如下:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>创建一个表格,使用类选择器美化</title> </head> <style> /*border-style 设置边框的线是实线 border-color 设置边框颜色*/ a:link{text-decoration: none;font-size: 20px;} .table{background: cyan; border-style: solid;border=1;border-color:pink;font-family: "楷体";font-size: medium;} .fieldset{width:500px; height: 80; text-align: center; font-size:25px;font-family: "微软雅黑";} </style> <body> <a href="http://www.baidu.com" target="_blank">百度一下,你就知道</a> <fieldset class="fieldset"> <legend>新用户注册:</legend> <table align="center" class="table" border= "1"> <thead align="center">填写个人信息</thead> <tbody align="center"> <tr> <th>姓名</th> <th><input type="text" name="user"/></th> </tr> <tr> <th>密码</th> <th><input type="password" name="ps"/></th> </tr> <tr> <th>性别</th> <th><input type="radio" name="sex" value="男" checked="checked"/>男 <input type="radio" name="sex"value="女"/>女 </th> </tr> <tr> <th>头像</th> <th><input type="file" value="上传头像"/> </th> </tr> <tr> <th>爱好</th> <th><input type="checkbox" name="hobby" value="篮球" />篮球 <input type="checkbox" name="hobby" value="跑步"/>跑步 <input type="checkbox" name="hobby" value="游泳"/>游泳 <input type="checkbox" name="hobby" value="煲剧"/>煲剧 <input type="checkbox" name="hobby" value="其他" checked="checked"/>其他 </th> </tr> <tr> <th>城市</th> <th><select> <option value="1" selected="selected">请选择城市?</option> <option value="2">北京</option> <option value="2">上海</option> <option value="2">南京</option> <option value="2">天津</option> <option value="2">四川</option> </select> </th> </tr> <tr> <th>自我介绍</th> <th><textarea>请填写自我介绍,不超过20个字! </textarea> </th> </tr> </tr> <tr> <th colspan="2"> <input type="submit" value="提交" /> <input type="reset" value="重置" /> </th> </th> </tr></tbody> </table> </fieldset> </body> </html>