2011-12-21 63 views
0

我有一張桌子,兩列。左列似乎是默認垂直居中。我想頂部對齊所有內容,而不是:表格單元格中的頂部對齊內容?

--------------------------- 
|   | words words | 
| apples | words words | 
|   | words words | 
--------------------------- 

是啊我怎樣才能得到第0列頂部對齊其內容?

<table width="100%"> 
<tr> 
    <td>apples</td> 
    <td>words words ....</td> 
</tr> 
</table> 

由於

回答

0

嘗試

表VALIGN = 「頂部」 寬度= 「100%」

風格=「垂直對齊:最佳;」

0

你可以試試這個代碼:

<table width="100%"> 
<tr> 
    <td align="center" valign="top">apples</td> 
    <td>words words words words words words words words</td> 
</tr> 
</table> 

enter image description here

0

的HTML方式是<tr valign=top>更換<tr>。您也可以在單個單元上使用valign屬性,但不能在整個表上使用(至少按規格)。

CSS方式是使用vertical-align屬性。例如,要使其適用於文檔中的所有表格單元格,請使用

<style> 
th, td { vertical-align: top; } 
</style>