藍森林首頁 | 返回主頁 | 本站地圖 | 站內搜索 | 聯繫信箱 |
 您目前的位置:首頁 > 自由軟件 > 技術交流 > 應用編程


    

藍森林 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]




Copyright © 1999-2000 LSLNET.COM. All rights reserved. 藍森林網站 版權所有。 E-mail : webmaster@lslnet.com