2016-05-10 35 views
0

我想調整錶行的高度爲24px。我已經嘗試將行高放入頂層CSS中,並將其寫入內聯。無法調整自舉錶行高

CSS:

tbody tr { 
line-height: 24px; 
height: 24px; 
padding: 0; 
} 

tbody td { 
line-height: 24px; 
height: 24px; 
padding: 0; 
} 

HTML:

<thead id='dontMove'> 
<tr id='theRow'> 
<th>Rank</th><th>Applicants</th><th># Enrolled</th> 
</tr> 
</thead> 
<tbody style='font-size: 12px;'> 

<tr style='height: 24px;'><td style='height: 20px;'>Contents</td></tr> 

//then I close the table after it's contents 

回答

0

環繞你的表內容在一個div像這樣用24

<table cellpadding="24"> 
    <thead id='dontMove'> 
     <tr id='theRow'> 
      <th>Rank</th> 
      <th>Applicants</th> 
      <th># Enrolled</th> 
     </tr> 
    </thead> 
    <tbody style='font-size: 12px;'> 
     <tr style='height: 24px;'> 
      <td style='height: 20px;'>Contents</td> 
     </tr> 
    </tbody> 
</table> 

一個CELLPADDING參見參考下面這個例子:http://www.w3schools.com/tags/att_table_cellpadding.asp

+0

w繼承人div? – user176105