2016-02-14 39 views
0

我有一個問題班<th>與​​相同嗎?

如果我把:

<table> 
    <tr> 
    <th class="width100px"></th> 
    </tr> 

    <tr> 
    <td></td> 
    </tr> 
</table> 

width100px = width: 100px

是否<td>採用相同的特性<th>

回答

1

如果您的意思是使用內聯樣式,那麼是的。

看看:

th { 
 
    /*demo styles*/ 
 
    background: red; 
 
    height: 100px; 
 
} 
 
.width100px { 
 
    width: 100px 
 
}
<h3>CSS Classes</h3> 
 
<table> 
 
    <tr> 
 
    <th class="width100px"></th> 
 
    </tr> 
 
    <tr> 
 
    <td></td> 
 
    </tr> 
 
</table> 
 
<hr /> 
 
<h3>CSS inline styles</h3> 
 
<table> 
 
    <tr> 
 
    <th style="width:100px"></th> 
 
    </tr> 
 
    <tr> 
 
    <td></td> 
 
    </tr> 
 
</table> 
 
<hr /> 
 
<h3>HTML old width tag - deprecated, don't use unless for email purposes</h3> 
 
<table> 
 
    <tr> 
 
    <th width="100"></th> 
 
    </tr> 
 
    <tr> 
 
    <td></td> 
 
    </tr> 
 
</table>

+0

謝謝你!我現在知道了 ! – LePetitRobot

+0

如果這解決了您的疑問,請確保您將此答案標記爲已接受:)很高興爲您提供幫助! – dippas