2016-05-10 36 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