查看: 8043|回复: 0
打印 上一主题 下一主题

HTML 语言教程---表格(TABLE)标记(TAGS)

[复制链接]
跳转到指定楼层
1#
发表于 2007-9-10 20:43:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
台州网址导航
表格的基本语法
<table>...</table> - 定义表格
<tr> - 定义表行
<th> - 定义表头
<td> - 定义表元(表格的具体数据)
带边框的表格:
<table border>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>     
</table>


Food Drink Sweet
A B C


不带边框的表格:

<table>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>     
</table>


Food Drink Sweet
A B C



跨多行、多列的表元(Table Span)

跨多列的表元 <th colspan=#>
<table border>
<tr><th colspan=3> Morning Menu</th>
<tr><th>Food</th>     <th>Drink</th> <th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>
</table>


Morning Menu
Food Drink Sweet
A B C


跨多行的表元 <th rowspan=#>
<table border>
<tr><th rowspan=3> Morning Menu</th>
    <th>Food</th> <td>A</td></tr>
<tr><th>Drink</th> <td>B</td></tr>
<tr><th>Sweet</th> <td>C</td></tr>
</table>


Morning Menu Food A
Drink B
Sweet C



表格尺寸设置

<table border=#>
边框尺寸设置:
<table border=10>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>     
</table>


Food Drink Sweet
A B C


<table border width=# height=#>
表格尺寸设置:
<table border width=170 height=100>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>     
</table>


Food Drink Sweet
A B C


<table border cellspacing=#>
表元间隙设置:
<table border cellspacing=10>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>     
</table>


Food Drink Sweet
A B C


<table border cellpadding=#>
表元内部空白设置:
<table border cellpadding=10>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>     
</table>


Food Drink Sweet
A B C



表格内文字的对齐/布局

<tr align=#>
<th align=#> #=left, center, right
<td align=#>
<table border width=160>
<tr>
          <th>Food</th><th>Drink</th><th>Sweet</th>
<tr>
          <td align=left>A</td>
          <td align=center>B</td>
          <td align=right>C</td>
</table>


Food Drink Sweet
A B C


<tr valign=#>
<th valign=#> #=top, middle, bottom, baseline
<td valign=#>
<table border height=100>
<tr>
          <th>Food</th><th>Drink</th>
          <th>Sweet</th><th>Other</th>
<tr>
          <td valign=top>A</td>
          <td valign=middle>B</td>
          <td valign=bottom>C</td>
          <td valign=baseline>D</td>
</table>


Food Drink Sweet Other
A B C D



表格在页面中的对齐/布局(Floating Table)

<table align=left>
<table align="left" border>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>
</table>
My favorites...<br>
cookies, chocolates, and more.

Food Drink Sweet
A B C
My favorites...
cookies, chocolates, and more.




<table align=right>
Food Drink Sweet
A B C
My favorites...
cookies, chocolates, and more.



<table vspace=# hspace=#> #=space value
<table align="left" border vspace=20 hspace=30>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>
</table>
My favorites...<br>
cookies, chocolates, and more.

Food Drink Sweet
A B C
My favorites...
cookies, chocolates, and more.




表格的标题

<caption align=#> ... </caption> #=left, center, right
<table border>
<caption align=center>Lunch</caption>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>     
</table>

Lunch
Food Drink Sweet
A B C


<caption valign=#> ... </caption> #=top, bottom
valign=top is default.
<table border>
<caption valign=bottom>Lunch</caption>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>     
</table>

Lunch
Food Drink Sweet
A B C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享分享 分享淘帖
台州维博网络(www.tzweb.com)专门运用PHP+MYSQL/ASP.NET+MSSQL技术开发网站门户平台系统等。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

网站推广
关于我们
  • 台州朗动科技(Tzweb.com)拥有多年开发网站平台系统门户手机客户端等业务的成功经验。主要从事:政企网站,系统平台,微信公众号,各类小程序,手机APP客户端,浙里办微应用,浙政钉微应用、主机域名、虚拟空间、后期维护等服务,满足不同企业公司的需求,是台州地区领先的网络技术服务商!

Hi,扫描关注我

Copyright © 2005-2026 站长论坛 All rights reserved

Powered by 站长论坛 with TZWEB Update Techonolgy Support

快速回复 返回顶部 返回列表