RE: [css-d] CSS Syntax for ID's

2005-10-12 Thread Peter Williams
> From: Akins, Chris
> 
> Sometimes people just write their id's as:
> #idName {}
> 
> Other times I see the "div" in front such as:
> div#idName
> 
> Since id's are unique anyway what's the difference here?  Does the one
> without the "div" explicitly stated NOT work in some cases?
> I've also seen similar with classes...

Chris,

I've always been one to use .classname amd #idname

What was revealed to me recently on this or another list was
that using selector.classname or selector#idname is useful
in indicating to others who might work on the site what the
intent of the original style was.

It is sort of self documenting by showing where and perhaps
in what circumstances that rule was intended to be used.

I'm not sure if I would adopt that convention, but I'll be
keeping it in mind for future occasions when it might be
a useful trick to have in the bag.

-- 
Peter Williams
__
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/


Re: [css-d] CSS Syntax for ID's

2005-10-12 Thread Jan Brasna

Since id's are unique anyway what's the difference here?


Readability. You know which element it refers to.


I've also seen similar with classes, but that seems easier to understand


It might be also about selector specifity. 
()


--
Jan Brasna aka JohnyB :: www.alphanumeric.cz | www.janbrasna.com
__
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/


[css-d] CSS Syntax for ID's

2005-10-12 Thread Akins, Chris
Just curious about differences I've seen in some stylesheets I've downloaded
and studied.

Sometimes people just write their id's as:

#idName {}

Other times I see the "div" in front such as:

div#idName

Since id's are unique anyway what's the difference here?  Does the one
without the "div" explicitly stated NOT work in some cases?

I've also seen similar with classes, but that seems easier to understand,
although I'm not sure I understand why a person couldn't just state the
class name also then apply it to whatever tag they want instead of being
explicit with it in the CSS rules.


Christopher Akins
Web Coordinator
Public Information Office - City of Springfield, MO
www.springfieldmogov.org
417-864-1118

"Everywhere is walking distance if you have the time." - Steven Wright

__
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/