用表继承 [英] inheritance with a table

查看:124
本文介绍了用表继承的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我知道如果你有一个带有以下内容的样式表:

tr {....}


那么它将匹配所有具有该风格的文档中的tr。

此外,如果您有以下内容:

..tableGeneral {...}

< table class =" tableGeneral">

.....

< / table>


然后它会将这种风格应用到桌子上。

我的问题是,有没有办法匹配所有的tr'和td'

在该表中,无需指定类是什么

每tr和td。

例如,而不是写:

。 .tableGernral {..}

..tableGeneral.headingRow {..}

..tableGeneral.tableData {..}


< table class =" tableGeneral">

< tr class =" headingRow">

< td> ....< / td>< / tr>

< tr>< td class =" tableData">

< / td>< / tr>

< tr>< td class =" tableData">

< / td>

< / tr>

< / table>


我可以写(语法错误):

..tableGernral {..}

..tableGeneral #headingRow {..}

..tableGeneral #td {..}


< table class =" tableGeneral">

< tr class =" headingRow">

< td> .. ..< / td>< / tr>

< tr>< td>

< / td>< / tr>

< tr>< td>

< / td>

< / tr>

< / table> ;


和td将自动匹配.tableGeneral.tr

类。


Jagdip

Ok, I know that if you have a stylesheet with the following:
tr {....}

Then it will match all the tr''s in that Document with that style.
Also, if you have the following:
..tableGeneral {...}

<table class="tableGeneral">
.....
</table>

Then it will apply that style to the table.
My question is, is there any way of matching all the tr''s and td''s
within that table without having to specify what the class is for
every tr and td.
For example, instead of writing:
..tableGernral {..}
..tableGeneral.headingRow {..}
..tableGeneral.tableData {..}

<table class="tableGeneral">
<tr class="headingRow">
<td>....</td></tr>
<tr><td class="tableData">
</td></tr>
<tr><td class="tableData">
</td>
</tr>
</table>

I could write (the syntax is wrong):
..tableGernral {..}
..tableGeneral #headingRow {..}
..tableGeneral #td {..}

<table class="tableGeneral">
<tr class="headingRow">
<td>....</td></tr>
<tr><td>
</td></tr>
<tr><td>
</td>
</tr>
</table>

and the td will automatically be matched to the .tableGeneral.tr
class.

Jagdip

推荐答案

2004年10月25日03:31:56 -0700,Jagdip Singh Ajimal< js ***** @ hotmail.com>

写道:
On 25 Oct 2004 03:31:56 -0700, Jagdip Singh Ajimal <js*****@hotmail.com>
wrote:
好的,我知道如果你有带有以下内容的样式表:
tr {....}

然后它将匹配该文档中所有tr的样式。
另外,如果你具有以下内容:
.tableGeneral {...}
< table class =" tableGeneral">
....
< / table> ;

然后它会将这种风格应用到桌面上。
我的问题是,是否有任何方法可以匹配所有tr'和td'的内容表格,无需指定每个tr / td的类。


是的。

..tableGeneral td {...}

将匹配< td>内的所有< td> ;表>和那个班级。

例如,而不是写:
.tableGernral {..}
.tableGeneral.headingRow {..}
.tableGeneral.tableData { ..}

< table class =" tableGeneral">
< tr class =" headingRow">
< td> ....< ; / td>< / tr>
Ok, I know that if you have a stylesheet with the following:
tr {....}

Then it will match all the tr''s in that Document with that style.
Also, if you have the following:
.tableGeneral {...}

<table class="tableGeneral">
....
</table>

Then it will apply that style to the table.
My question is, is there any way of matching all the tr''s and td''s
within that table without having to specify what the class is for
every tr and td.
Yes.
..tableGeneral td { ... }
will match all <td>s inside the <table> with that class.
For example, instead of writing:
.tableGernral {..}
.tableGeneral.headingRow {..}
.tableGeneral.tableData {..}

<table class="tableGeneral">
<tr class="headingRow">
<td>....</td></tr>




如果这是标题行,那么为什么它不包含< th>而不是< td>?


那么你可以使用

..tableGeneral th {...}

来设计标题和摆脱行类。


史蒂夫



If this is a heading row then why doesn''t it contain <th> instead of <td>?

Then you can use
..tableGeneral th { ... }
to style the headers and get rid of the row class.

Steve


2004年10月25日03:31:56 -0700, js*****@hotmail.com (Jagdip Singh

Ajimal)写道:
On 25 Oct 2004 03:31:56 -0700, js*****@hotmail.com (Jagdip Singh
Ajimal) wrote:
好的,我知道如果你有样式表...
Ok, I know that if you have a stylesheet...




[... bla,bla,bla .. 。]


< http://www.w3.org/TR/CSS21/selector.html#q1>


它'所有你知道的规格......


-

雷克斯



[... bla, bla, bla ...]

<http://www.w3.org/TR/CSS21/selector.html#q1>

It''s all in the specs you know...

--
Rex


Jagdip Singh Ajimal< js ***** @ hotmail.com>:
Jagdip Singh Ajimal <js*****@hotmail.com>:

< table class =" tableGeneral">
< tr class =" headingRow">< td> ....< / td>< / tr>
< tr>< td class =" tableData">< / td>< / tr> ;
< tr>< td cla ss =" tableData">< / td>< / tr>
< / table>

<table class="tableGeneral">
<tr class="headingRow"><td>....</td></tr>
<tr><td class="tableData"></td></tr>
<tr><td class="tableData"></td></tr>
</table>




尽管你的CSS相关问题看起来好像你真的很想

写道:


< table class =" general">< thead>

< tr>< th> ....< / th>< / tr>

< / thead>< tbody>

< ; tr>< td>< / td>< / tr>

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

< / tbody>< / table>


table.general thead {foo:bar}

table.general tbody {foo:baz}


-

酒精并没有造成20年代和30年代的高犯罪率,禁酒令。

和药物不会导致今天令人担忧的犯罪率,但药物禁令确实如此。

(美国地区法官James C. Paine,1991年11月)



Despite your CSS-related question this looks as if you really wanted to
write:

<table class="general"><thead>
<tr><th>....</th></tr>
</thead><tbody>
<tr><td></td></tr>
<tr><td></td></tr>
</tbody></table>

table.general thead {foo: bar}
table.general tbody {foo: baz}

--
Alcohol didn''t cause the high crime rates of the ''20s and ''30s, Prohibition did.
And drugs do not cause today''s alarming crime rates, but drug prohibition does.
(US District Judge James C. Paine, November 1991)


这篇关于用表继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆