格語法:
注意:顏色使用格式有三種:rgb(x,x,x) #xxxxxx colorname
<table width=""></table>指定表格的寬度大小(使用數(shù)字pixel或%)
<table border=""></table>設(shè)定表格邊框大小(使用數(shù)字pixel)
<table align=""></table>表格位置,置左,為默認值
align屬性:left(左對齊表格,默認值)、right(右對齊表格)、center(居中對齊表格)
<table bgcolor=""></table>設(shè)定表格的背景顏色
<table cellpadding=""></table>指定內(nèi)容與網(wǎng)格線之間的間距(使用數(shù)字pixel或%)
<table cellspacing=""></table>指定網(wǎng)格線與網(wǎng)格線之間的距離(使用數(shù)字pixel或%)
<table border="1" cellspacing="0" cellpadding="0">
通常表格, 這兩個參數(shù)都設(shè)置為 0 。
<table rules="rows"></table>規(guī)定內(nèi)側(cè)邊框的哪個部分是可見的。(兼容性差)
rules屬性:none 沒有線條。
groups 位于行組和列組之間的線條。
rows 位于行之間的線條。
cols 位于列之間的線條。
all 位于行和列之間的線條。
<table summary="Monthly savings for the Flintstones family"></table>
定義了表格內(nèi)容的摘要:
表格結(jié)構(gòu):
在使用表格進行布局時, 可以將表格劃分為頭部、主體和頁腳, 具體如下所示:
<thead></thead>:用于定義表格的頭部, 必須位于<table></table>標記中, 一般包含網(wǎng)頁的logo和導航等頭部信息。
<tfoot></tfoot>:用于定義表格的頁腳, 位于<table></table>標記中<thead></thead>標記之后, 一般包含網(wǎng)頁底部的企業(yè)信息等。
<tbody></tbody>:用于定義表格的主體, 位于<table></table>標記中<tfoot></tfoot>標記之后, 一般包含網(wǎng)頁中除頭部和底部之外的其他內(nèi)容。
注意:在沒有<tbody></tbody>比較的情況下, 瀏覽器會自動添加<tbody></tbody>標記。
<table bordercolor=""></table>設(shè)定表格邊框的顏色
<table cols=""></table>指定表格的欄數(shù)
<table height=""></table>指定表格的高度大小(使用數(shù)字)
<table background=""></table>背景圖片的URL=就是路徑網(wǎng)址(默認是repeat:水平和垂直方向重復)
<table bordercolordark=""></table>設(shè)定表格暗邊框的顏色
<table bordercolorlight=""></table>設(shè)定表格亮邊框的顏色
<tr align=""></tr> 定義表格行的內(nèi)容對齊方式。
align屬性值:right、left、center、justify、char
<tr bgcolor=""></tr> 規(guī)定表格行的背景顏色。
<tr valign=""></tr> 規(guī)定表格行中內(nèi)容的垂直對齊方式。
valign屬性值right、left、center、justify、char
<td colspan=""></td>指定儲存格合并欄的欄數(shù)(使用數(shù)字)
<td rowspan=""></td>指定儲存格合并列的列數(shù)(使用數(shù)字)
<td align=""></td> 調(diào)整表格字段之左右對齊
<td bgcolor=""></td> 設(shè)定表格字段之背景顏色
<td colspan="" rowspan=""></td> 表格字段的合并
<td valign=""></td> 調(diào)整表格字段之上下對齊
<td width=""></td> 調(diào)整表格字段寬度
<td nowrap="nowrap"></td> 規(guī)定表格單元格中的內(nèi)容不換行(注意只有一個值:nowrap)
<caption></caption>為表格加上標題
<caption align="">設(shè)定表格標題位置
align屬性:left, center(默認值), right
<th></th> 定義表頭(粗體居中)
細表格邊框
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="158" height="68">
<tr>
<td width="158" height="68"></td>
</tr>
</table>
表格創(chuàng)建后瀏覽器會自動添加<tbody>標簽
lt;html>
<head>
<title>實現(xiàn)表格</title>
<head>
<body >
<table border="1px" align="center" width="477"><!--border為邊框-->
<tr><!--行標簽-->
<td >學</td ><!--表示一個單元格-->
<td >習</td >
<td >HTML</td >
</tr>
<tr>
<td >學</td >
<td >習</td >
<td >HTML</td >
</tr>
<tr>
<td >關(guān)</td >
<td >注</td >
<td >我</td >
</tr>
</table>
</body>
</html>
.表格的寬度 高度 邊框 <width> <height> <border>
2.表格的背景顏色和圖片 <colcr>顏色背景圖片顏色可通過<background> <bgcolor>背景顏色
3.表格以及單元格內(nèi)容的對齊方式 <aligh>分為<right>右對齊 <center>居中對齊 <left>左對齊
4.單元格的填充和間距 <cellspacing>間距 <cellpadding>填充
5.<font>標簽可以設(shè)置字體字號以及顏色
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>優(yōu)化表格</title>
</head>
<body>
<table border="0" width="395" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4" background=""><font color="white"></font><b> 本周暢銷筆記本排名top3<font></font></b></td>
</tr>
</table>
<table>
<tr>
<td>
<table>
<tr>
<td colspan="2">京東超市/td>
</tr>
<tr>
<td colspan="2">< img src="img/1.jpg" alt=""></td>
</tr>
<tr>
<td>< img src="img/人.png" alt=""></td>
<td>< img src="img/羅賓.jpg" alt=""></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
*請認真填寫需求信息,我們會在24小時內(nèi)與您取得聯(lián)系。