当前位置: 首页 > 图文教程 > 网页制作 > HTML/XHTML教程 > HTML表格标记教程(14):表格的表头

HTML/XHTML教程
理解表现和结构相分离
HTML语言剖析(一)Html简介
HTML语言剖析(二)HTML标记一览
HTML语言剖析(三)文件标记
HTML语言剖析(四)排版标记
HTML语言剖析(五)字体标记
HTML语言剖析(六)清单标记
采访Eric Meyer的10个问题
Flash页面如何通过校验
为什么要抛弃HTML
典型的三行二列居中高度自适应布局
盒模型bug的解决方法
用!important解决IE和Mozilla的布局差别
使用DIV之后,什么时候使用TABLE
同一个页面用多个id有什么影响
定义标题的最好方法
左中右3栏布局中最先显示中栏内容的方法
alt属性和title属性
在IE中为abbr标签加样式
HTML4标签的默认样式列表

HTML/XHTML教程 中的 HTML表格标记教程(14):表格的表头


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 32 ::
收藏到网摘: n/a


在HTML语言中,可以自动通过标记为表格添加标题。另外,表格的第一行称为表头,这也可以通过HTML标记来实现。
基本语法
<TABLE> ....
  <TR>
   <TH>标题1</TH><TH>标题2</TH><TH>标题3</TH><TH>标题4</TH><TH>标题5</TH>
  </TR>
 ........
</TABLE>
语法解释
通过BORDER属性定义边框线的宽度,单位为像素。
<html>
<head>
<title>表格标记的综合例子</title>
</head>
<body>
<table border="1" width="80%" bgcolor="#e8e8e8" cellpadding="2" bordercolor="#0000ff" bordercolorlight="7d7dff" bordercolordark="#0000a0">
<tr>
<th width="30%" colspan="2" valign="bottom">大西洋赛区</th>
<th width="30%" colspan="2" valign="bottom">中部赛区</th>
<th width="30%" colspan="2" valign="bottom">东南赛区</th>
</tr>
<tr>
<td width="16%" align="center">凯尔特人</td>
<td width="16%" align="center">76人</td>
<td width="17%" align="center">活塞</td>
<td width="17%" align="center">公牛</td>
<td width="17%" align="center">热火</td>
<td width="17%" align="center">奇才</td>
</tr>
<tr>
<td width="16%" align="center">网</td>
<td width="16%" align="center">尼克斯</td>
<td width="17%" align="center">步行者</td>
<td width="17%" align="center">骑士</td>
<td width="17%" align="center">魔术</td>
<td width="17%" align="center">山猫</td>
</tr>
<tr>
<td width="16%" align="center">猛龙</td>
<td width="16%" align="center">过江</td>
<td width="17%" align="center">雄鹿</td>
<td width="17%" align="center">芝加歌</td>
<td width="17%" align="center">老鹰</td>
<td width="17%" align="center">姚明</td>
</tr>
</table>
</body>
</html>
其中<TH></TH>是指的表格的表头和标题。