|
藍森林 http://www.lslnet.com 2006年8月25日 8:28
請教一個關於css的問題。
在css中,我已經定義了一個:
TD
{
FONT-FAMILY:細明體;FONT-SIZE: 9pt;line-height: 170%;
}
但是我想在一些表格另外定義字體的行距,比如;100%,請問怎麼寫,怎麼調用?
我寫了一個:
.TD_ind_article
{
background-color: #C2D4D9; color: #000000;font-size: 12px;line-height: 138%;
}
然後在相關的位置調用:
<td align="left" valign="top" class="TD_ind_article">
但是單元格裡的顯示樣式沒有變化,請問怎麼回事? |
這是由於CSS引用的優先級導致的,一般按照就近原則. 看看變了沒有:
[html]
<style>
td{ line-height:170%}
.aa{ line-height:220%}
</style>
<table border>
<tr>
<td>aaaaaaaa</td><td>aaaaaaaaaaa</td>
</tr>
<tr>
<td class=aa>aaaaaaa</td><td>aaaaaaaaaaa</td>
</tr>
</table>
[/html]
|
多謝,好像要注意個問題,就是如果表格內的文字是帶鏈接的,就還必須加上 .*** a{***;line-height:220%}才管用。
現在遇到的問題:表格裡面的內容是居中的,我加上 text-align: left 也沒用:
.TD_ind_article
{
background-color: #C2D4D9; color: #000000; text-align: left;font-size: 12px;line-height: 140%;
}
請問怎麼寫正確。 |
這樣也沒錯啊
[html]
<style>
td{ line-height:170%; text-align:center}
.aa{ line-height:220%}
</style>
<table border>
<tr>
<td width=300 style="text-align:left">aaaaaaaa</td><td>aaaaaaaaaaa</td>
</tr>
<tr>
<td class=aa>aaaaaaa</td><td>aaaaaaaaaaa</td>
</tr>
</table>
[/html] |
|