HTML <th> 標(biāo)簽的 height 屬性
定義和用法
height 屬性規(guī)定表格的表頭單元格的高度。
通常,單元格占用的空間就是它顯示內(nèi)容需要的空間。height 屬性用于為單元格設(shè)置預(yù)定義的高度。
實(shí)例
兩個(gè)帶有預(yù)定義高度的單元格:
<table border="1"> <tr> <thheight="100px"
>Company in USA</th> <thheight="100px"
>Address</th> </tr> <tr> <td>Apple, Inc.</td> <td>1 Infinite Loop Cupertino, CA 95014</td> </tr> <tr> <td>Google, Inc.</td> <td>1600 Amphitheatre Parkway Mountain View, CA 94043</td> </tr> </table>
瀏覽器支持
盡管不贊成使用 height 屬性,但是所有瀏覽器都支持它。
兼容性注釋
在 HTML 4.01 中,不推薦使用 th 元素的 height 屬性;在 XHTML 1.0 Strict DTD 中,不支持 th 元素的 height 屬性。
請(qǐng)使用 CSS 代替。
CSS 語法:<th style="height:100px">
在我們的 CSS 教程中,您可以找到更多有關(guān) height 屬性 的細(xì)節(jié)。
語法
<th height="value">
屬性值
值 | 描述 |
---|---|
pixels | 以像素計(jì)的高度值(比如 "100px")。 |
percent | 以包含元素百分比計(jì)的高度值(比如 "20%")。 |