HTML表格的基本布局

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>表格布局</title>
	</head>
	<body>
		<table width="600" align="center" height="50" border="1" cellpadding="10" cellspacing="5" rules="all">
			<caption align="bottom" align="center">学生成绩表</caption>
			<tr bgcolor="blue">
				<th>班级</th>
				<th>姓名</th>
				<th>性别</th>
				<th>年龄</th>
				<th>成绩</th>
			</tr>
			<tr>
				<td>计科一班</td>
				<td>张三</td>
				<td>男</td>
				<td>23</td>
				<td>90</td>
			</tr>
			<tr>
				<td>计科二班</td>
				<td>李四</td>
				<td>女</td>
				<td>245</td>
				<td>80</td>
			</tr>
			<tr>
				<td>计科三班</td>
				<td>孙乾</td>
				<td>男</td>
				<td>28</td>
				<td>70</td>
			</tr>
			<tr>
				<td>计科四班</td>
				<td>钱八</td>
				<td>男</td>
				<td>21</td>
				<td>60</td>
			</tr>
			<tr>
				<td>计科五班</td>
				<td>王五</td>
				<td>女</td>
				<td>26</td>
				<td>50</td>
			</tr>
<div topmargin="0" leftmargin="0">  <!-- 表格整体对齐方式 --><!-- rowspan="2" colspan="2"表格行和列所占单元格 -->
		</table>

运行结果如下:

表格的页面布局

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>表格的页面布局</title>
	</head>
	<body>
		<!-- 表格格式<table>  <caption>表名</caption> <tr><th></th></tr><tr><td></td></tr></table>
				每行每个<tr></tr>  表头<th></th> 表内容<td></td>rowspan="2" 行数 colspan="2"列数valign=""垂直对齐   cellpadding="10" cellspacing="5"单元格与单元格之间的距离-->
						
	<table  width="960"height="600"  cellpadding="0"cellspacing="0" border="0" align="">
			<!-- 	cellpadding和cellspacing边框距离   -->
		<tr align="center" height="100" bgcolor="red"> 
			<td> <font size="6px"><strong>表格顶部</strong></font></td>
		</tr>
		<tr>
			<td>
	<table height="400" align="left" width="30%" bgcolor="bisque">
		<tr align="center">
			<td><font  size="3" color="blue" face="隶书"><b>中间左部</b></font></td>
		</tr>
	</table>
	<table align="left" height="400" width="70%" bgcolor="cornflowerblue">
		<tr align="center">
			<td><font size="3" color="blue" face="隶书"><b>中间右部</b></font></td>
		</tr>
	</table>
		    </td>
		<tr>
		<tr align="center" height="100" bgcolor="red">
			<td> <font color="white" size="6"><strong>表格底部</strong></font> </td>
		</tr>
    </table>
	</body>
</html>

运行结果如下:

 

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wj18740503137

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值