[Javascript] separating structure, style, and behavior

liorean liorean at f2o.org
Fri May 7 09:54:40 CDT 2004


Terry Riegel wrote:
> Can anyone explain this to me.
> 
> 
> #localnav td p,
> #localnav td a:link,
> #localnav td a:visited {padding-right: 10px; display: block; color: 
> #000000; text-decoration: none;}
> #localnav {background-color: #ffffff;}
> 
> 
> What does the comma after p and after link mean?

It's a selector separator. Instead of writing

#localnav td p {padding-right: 10px; display: block; color:
#000000; text-decoration: none;}
#localnav td a:link {padding-right: 10px; display: block; color:
#000000; text-decoration: none;}
#localnav td a:visited {padding-right: 10px; display: block; color:
#000000; text-decoration: none;}

you can place the selectors as a comma separated list and use only one 
declaration block. There is a difference, though. If a browser doesn't 
support one of the comma separated selectors, it will discard the entire 
ruleset, while if you use one ruleset for each selector, the browser 
that doesn't support one of the selectors will still apply the other 
selectors.


(Isn't this off-topic for this list, though? Wouldn't CSS-D be a better 
list for this issue?)
-- 
David "liorean" Andersson

ViewStyles, ViewScripts, SwitchStyles and GraphicsInfo bookmarklets:
<http://liorean.web-graphics.com/>
Hangouts:
<http://codingforums.com/> <http://yourmusicforums.com/>



More information about the Javascript mailing list