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

HTML/XHTML教程
HTML5之后W3C将制定无版本号的HTML
IE6必然灭亡的最新6个理由
网页制作教程:单独对IE6进行兼容
Firefox 3.6频繁崩溃的问题
HTML5的发展:微格式和相关的属性名称
Chrome最新4.0版本支持GreaseMonkey脚本
网页前端常见的攻击方式和预防攻击办法
HTML5标准将把互联网视频扔回到黑暗时代
靠我们自己的力量把IE6推向灭亡
近期热点:HTML5是否真的可以取代Flash
网页知识新手了解:网页设计的发展历史
TinyEditor:简洁且易用的html所见即所得编辑器
ANSI,Unicode,UTF-8网页编码的区别
HTML5实例:20个使用HTML5编写的网站
网页表单设计:主要行为与次要行为
HTML网页实例代码:简洁漂亮的跳转等待页面
经验分享:关于网页布局排版的流程问题
W3C发布7个HTML工作草案
HTML5 旨在解决 Web 中的交互
网页优化的最基础部分:HTML的优化

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 46 ::
收藏到网摘: 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>是指的表格的表头和标题。