基本的后代选择者问题 [英] basic descendant selector question

查看:83
本文介绍了基本的后代选择者问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好


我刚开始使用CSS&我正在通过Eric Meyer阅读

CSS,特别是第一章。


他创造了这些风格:


td #advertising {stuff}

#content-top td {stuff}

tr td #sidetop {stuff}


so我的问题....


1.我可以将td#广告简化为#advert吗?


2.我可以缩短tr td #sidetop到#sidetop?


tia -

Mr T.

hello

i''m just getting started with CSS & am reading through Eric Meyer on
CSS, specifically the first chapter.

he creates these styles:

td#advert {stuff}
#content-top td { stuff }
tr td#sidetop {stuff }

so my questions....

1. can i shorten td#advert to just #advert?

2. can i shorten tr td#sidetop to just #sidetop?

tia -
Mr T.

推荐答案

2004年6月16日星期三19:11:51 -0700,Laurence Tureaud写道:
On Wed, 16 Jun 2004 19:11:51 -0700, Laurence Tureaud wrote:
你好

我刚入手CSS&我正在通过Eric Meyer阅读CSS,特别是第一章。

他创造了这些风格:

td#advert {stuff}
#content -top td {stuff}
tr td #sidetop {stuff}

所以我的问题....

1.我可以将td #admin缩短为just #advert?


是的,但只有在广告ID 的持有者永远不会改变或所有风格都相关的情况下才会推荐任何可能的''广告''

元素。请记住,ID可能会在不同的页面上多次使用。

2.我可以将tr td #toptop缩短为#sidetop吗?
hello

i''m just getting started with CSS & am reading through Eric Meyer on
CSS, specifically the first chapter.

he creates these styles:

td#advert {stuff}
#content-top td { stuff }
tr td#sidetop {stuff }

so my questions....

1. can i shorten td#advert to just #advert?
Yes, but it''s only recommended if either the holder of the ''advert'' ID
will never change or all the styles are relevant to any possible ''advert''
element. Keep in mind an ID may be used more than once on different pages.
2. can i shorten tr td#sidetop to just #sidetop?




通过计算

前者和后者选择的页面上的哪些元素来确定自己,然后确定差异是否与b $ b相关。


-

有人说连线没有像现实世界那样的政治边界,

但是有太多无意义的呐喊无政府主义者或白痴谁认为恶作剧是一场革命。



Decide for yourself by working out which elements on which pages the
former and the latter select and then determining if the difference is
relevant.

--
Some say the Wired doesn''t have political borders like the real world,
but there are far too many nonsense-spouting anarchists or idiots who
think that pranks are a revolution.


Laurence Tureaud写道:
Laurence Tureaud wrote:
td#advert {stuff}
#content-top td {stuff}
tr td #sidetop {stuff}

1.我可以将td#advert缩短为只是#advert?


这取决于具体情况。 td #adnad仅选择< td>元素

,其id =" advert",而#advert选择任何元素,其中

id =" advert"。另一个页面是否有< div id =" advert"> ;?你想要

风格适用于两者吗?

2.我可以将tr td #toptop缩短为#sidetop吗?
td#advert {stuff}
#content-top td { stuff }
tr td#sidetop {stuff }

1. can i shorten td#advert to just #advert?
This depends on the context. td#advert selects only <td> elements
whose id="advert", while #advert selects any element whose
id="advert". Will another page have <div id="advert">? Do you want the
style to apply to both?
2. can i shorten tr td#sidetop to just #sidetop?




我不确定tr的意义。 A< td>元素是*总是* a

后代的< tr>,所以它似乎是多余的。但除此之外,同样的问题也适用于b $ b。你想要什么样的风格? < td id =" sidetop">?或者任何

元素,其id =" sidetop"?


-

Brian(删除.invalid到给我发电子邮件)
http://www.tsmchughs.com/


2004年6月17日星期四02:14:22 GMT,Owen Jacobson

< an ****** @ lionsanctuary.net>写道:
On Thu, 17 Jun 2004 02:14:22 GMT, Owen Jacobson
<an******@lionsanctuary.net> wrote:
1.我可以将td #admin缩短为#advert?
1. can i shorten td#advert to just #advert?



是的,但是只有当广告ID的持有者永远不会改变或所有风格都与任何可能的广告元素相关时,才建议使用它。请记住,ID可能会在不同的页面上多次使用。



Yes, but it''s only recommended if either the holder of the ''advert'' ID
will never change or all the styles are relevant to any possible ''advert''
element. Keep in mind an ID may be used more than once on different
pages.



aha ..但是ID应该只在任何给定的页面上使用一次,对吧? br />
因为我正在阅读一本书Dreamweaver 2004 mx missing manual说一个

ID用于格式化页面上的唯一项目。


我理解你对多个页面的看法。

谢谢 -

matt


aha.. but an ID should be used only once on any given page, right?
because a book i''m reading "dreamweaver 2004 mx missing manual" says an
ID is for formatting a unique item on a page.

I understand what you say about multiple pages though.

thanks-
matt


这篇关于基本的后代选择者问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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