htmledit_views">
HTML和CSS 表格练习
html"><!DOCTYPE html>
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>HTML表格练习</title><style>.container {width: 80%;margin: 0 auto;/* 水平居中 上下不变,左右自动调整 */}.table {border: 2px solid black;/* 边框 */border-collapse: collapse;width: 100%;margin-top: 50px;/* 距离上一个元素的距离: 50px */}.table td,.table th {border: 2px solid #ddd;padding: 5px;text-align: center;}</style>
</head><body><div class="container"><table class="table"><thead><tr><th>姓名</th><th>年龄</th><th>性别</th></tr></thead><tbody><tr><td>张三</td><td>18</td><td>男</td></tr><tr><td>李四</td><td>24</td><td>男</td></tr><tr><td>王五</td><td>25</td><td>男</td></tr></tbody></table></div></body></html>
HTML和CSS 表单练习
html"><!DOCTYPE html>
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>表单练习</title><style>.form {display: flex;/* 启用弹性布局 */justify-content: space-between;padding: 20px;background-color: #f9f9f9;}.form label {margin-right: 20px;padding: 5px 10px;}.form input,.form select {margin-right: 50px;padding: 5px 10px;/* border-color: 1px solid #ccc; */border-radius: 5px;width: 260px;}.container {width: 80%;margin: 0 auto;}</style>
</head><body><div class="container"><form action="#" method="post" class="form"><div><label for="gender">性别</label><select name="gender" id="gender"><option value="0">请选择学生性别</option><option value="1">男</option><option value="2">女</option></select></div><div><label for="gender">性别</label><select name="gender" id="gender"><option value="0">请选择学生性别</option><option value="1">男</option><option value="2">女</option></select></div><div><label for="job">职位</label><select name="job" id="job"><option value="0">请选择学生职位</option><option value="1">班长</option><option value="2">副班长</option><option value="3">课代表</option><option value="4">无</option></select></div></form></div></body></html>