推薦教程:Html教程
<table> 標(biāo)簽定義 HTML 表格。
簡單的 HTML 表格由 table 元素以及一個(gè)或多個(gè) tr、th 或 td 元素組成。
tr 元素定義表格行,th 元素定義表頭,td 元素定義表格單元。
更復(fù)雜的 HTML 表格也可能包括 caption、col、colgroup、thead、tfoot 以及 tbody 元素。
<table border="1"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr></table>
可選的屬性
屬性 | 值 | 描述 |
align |
left center right |
不贊成使用。請使用樣式代替。 規(guī)定表格相對周圍元素的對齊方式。 |
bgcolor |
rgb(x,x,x) #xxxxxx colorname |
不贊成使用。請使用樣式代替。 規(guī)定表格的背景顏色。 |
border | pixels | 規(guī)定表格邊框的寬度。 |
cellpadding |
pixel s% |
規(guī)定單元邊沿與其內(nèi)容之間的空白。 |
cellspacing |
pixel s% |
規(guī)定單元格之間的空白。 |
frame |
voi dabove below hsides lhs rhs vsides box border |
規(guī)定外側(cè)邊框的哪個(gè)部分是可見的。 |
rules |
none groups rows cols all |
規(guī)定內(nèi)側(cè)邊框的哪個(gè)部分是可見的。 |
summary | text | 規(guī)定表格的摘要。 |
width |
% pixels |
規(guī)定表格的寬度。 |
<table> 標(biāo)簽支持 HTML 中的全局屬性。
<table> 標(biāo)簽支持 HTML 中的事件屬性。