• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

HTML表格(TABLE)标记(TAGS)_html

html 搞代码 7年前 (2018-06-15) 174次浏览 已收录 0个评论

HTML表格(TABLE)标记(TAGS)_html 表格的基本语法

<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 ########################–>

HTML表格(TABLE)标记(TAGS)_html 跨多行、多列的表元(Table Span)

<——Colspan——->

http://www.gaodaima.com/32293.htmlHTML表格(TABLE)标记(TAGS)_html

跨多列的表元 <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

<——Rowspan——->

跨多行的表元 <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

<–################## Size ########################–>

HTML表格(TABLE)标记(TAGS)_html 表格尺寸设置

<——Border——->

<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

<——Length——->

<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

<——CellSpacing——->

<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

<——CellPadding——->

<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

<–################## Text in Table ########################–>

HTML表格(TABLE)标记(TAGS)_html 表格内文字的对齐/布局

<——ALIGN——->

<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

<——VALIGN——->

<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 ########################–>

HTML表格(TABLE)标记(TAGS)_html 表格在页面中的对齐/布局(Floating Table)

<——left——->

<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.


<——right——->

<table align=right>

Food Drink Sweet
A B C

My favorites…
cookies, chocolates, and more.


<table vspace=# hspace=#> #=space value HTML表格(TABLE)标记(TAGS)_html

<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.


<–################## Table Caption ########################–>

HTML表格(TABLE)标记(TAGS)_html 表格的标题 HTML表格(TABLE)标记(TAGS)_html

<——Caption align——->

<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 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

欢迎大家阅读《HTML表格(TABLE)标记(TAGS)_html》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:HTML表格(TABLE)标记(TAGS)_html

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址