Day02 HTML制作表格以及练习

it2023-10-26  77

HTML 制作表格

table标签:表格标签 tr标签:表格中的行 th标签:表格的表头 默认居中 td标签:表格单元格 默认左并齐 cellpadding="数字"填充外边框 cellspacing=“数字” 填充表格间距 bgcolor 背景颜色 align 水平调节位置 valign 竖直调节距离 colspan=“合并单元格数” 跨列(行) 填充单元格 columnspan rowspan=“合并单元格数” 跨行(列) 填充单元格 rowspan 快捷添加x行y列个单元格:table>trx>th*y + "Tab"键 del标签等于s标签:一段带有已删除部分和新插入部分的文本

练习1:简历的表格

任务:

<body> <h1 align="center"> <b>个人简历</b> </h1> <table border="1" width="600" cellpadding="10" cellspacing="0" align="center"> <tr > <th width="100" bgcolor="skyblue">姓名</th> <th width="150"> </th> <th width="100" bgcolor="skyblue">性别</th> <th width="150"> </th> <th width="100" rowspan="5">照片</th> </tr> <tr align="center"> <td bgcolor="skyblue">出生年月</td> <td> </td> <td bgcolor="skyblue">籍贯</td> <td> </td> </tr> <tr align="center"> <td bgcolor="skyblue">政治面貌</td> <td> </td> <td bgcolor="skyblue">民族</td> <td> </td> </tr> <tr align="center"> <td bgcolor="skyblue">健康情况</td> <td> </td> <td bgcolor="skyblue">婚姻状况</td> <td> </td> <tr align="center"> <td bgcolor="skyblue">联系电话</td> <td> </td> <td bgcolor="skyblue">电子邮箱</td> <td>www.51jianli.com</td> </tr> <tr align="center"> <td bgcolor="skyblue">求职意向</td> <td colspan="4"></td> </tr> <tr align="center" height="200"> <td bgcolor="skyblue">工作经历</td> <td colspan="4"></td> </tr> <tr align="center" height="50"> <td bgcolor="skyblue">教育经历</td> <td colspan="4"></td> </tr> <tr align="center" height="50"> <td bgcolor="skyblue">英语水平</td> <td colspan="4"></td> </tr> </tr> <tr align="center" height="50"> <td bgcolor="skyblue">计算机水平</td> <td colspan="4"></td> </tr> </tr> <tr align="center" height="80"> <td bgcolor="skyblue">自我评价</td> <td colspan="4"></td> </tr> </table> </body>

我的运行结果:

练习二:课程表

<body> <h3 align="center">课程表</h3> <table align="center" border="1" cellspacing="10" cellpadding="10"> <tr> <th>项目</th> <th colspan="5">上课</th> <th colspan="2">休息</th> </tr> <tr bgcolor="pink"> <th>星期</th> <th>星期一</th> <th>星期二</th> <th>星期三</th> <th>星期四</th> <th>星期五</th> <th>星期六</th> <th>星期日</th> </tr> <tr> <th rowspan="4">上午</th> <th>语文</th> <th>数学</th> <th>英语</th> <th>英语</th> <th>物理</th> <th>计算机</th> <th rowspan="4">休息</th> </tr> <tr> <th>数学</th> <th>数学</th> <th>地理</th> <th>化学</th> <th>历史</th> <th>计算机</th> </tr> <tr> <th>语文</th> <th>数学 </th> <th>历史</th> <th>计算机</th> <th>物理</th> <th>化学</th> </tr> <tr> <th>数学</th> <th>数学</th> <th>地理</th> <th>化学</th> <th>历史</th> <th>计算机</th> </tr> <tr> <th rowspan="2">下午</th> <th>数学</th> <th>数学</th> <th>地理</th> <th>化学</th> <th>历史</th> <th>计算机</th> <th rowspan="2">休息</th> </tr> <tr> <th>数学</th> <th>数学</th> <th>地理</th> <th>化学</th> <th>历史</th> <th>计算机</th> </tr> </table> </body>

运行结果:

练习三:水果价格表

目标:

<body> <h2 align="center"> <b>水果展示</b> </h2> <hr style="color: red;"/> <table align="center" border="0" width=800" > <tr> <th rowspan="4" ><img src="水果展示/banana.jpg" ></th> <th align="left">名称:香蕉</th> <th rowspan="4" ><img src="水果展示/pineapple.jpg" </th> <th align="left">名称:菠萝</th> <th rowspan="4" ><img src="水果展示/banana.jpg" ></th> <th align="left">名称:香蕉</th> </tr> <tr> <th align="left"><del>¥19.80</del> </th> <th align="left"><del>¥19.80</del> </th> <th align="left"><del>¥19.80</del> </th> </tr> <tr> <th align="left">¥9.80</th> <th align="left">¥9.80</th> <th align="left">¥9.80</th> </tr> <tr> <th align="left">产地:海南</th> <th align="left">产地:广西</th> <th align="left">产地:海南</th> </tr> <tr> <th align="right">名称:桃子</th> <th rowspan="4"><img src="水果展示/peach.jpg"</th> <th align="right">名称:梨</th> <th rowspan="4"><img src="水果展示/pear.jpg"</th> <th align="right">名称:葡萄</th> <th rowspan="4"><img src="./水果展示/grape.jpg"</th> </tr> <tr> <th align="right"><del>¥19.80</del></th> <th align="right"><del>¥19.80</del></th> <th align="right"><del>¥19.80</del></th> </tr> <tr> <th align="right">¥9.80</th> <th align="right">¥9.80</th> <th align="right">¥9.80</th> </tr> <tr> <th align="right">产地:陕西</th> <th align="right">产地:陕西</th> <th align="right">产地:陕西</th> </tr> </table> <hr style="color: red;"/> <h4 align="center">公司地址:陕西省西安市 <br /> 电话:029-98765432 </h4> </body>

我的运行结果:

最新回复(0)