[css-d] id and class selectors

2010-07-21 Thread TriState Advantage, Kris Jacobson
Hi!
Today's my birthday. Here's a gift for you:

http://onwebdev.blogspot.com/2010/07/css-id-and-class-selectors-details.html

Thank you for this article, I found it a good reinforcement of using id's and 
class's.
I have a questions on styling lists and links in a div.
I have been styling lists using id's
example
#div ul
#div li
#div li a
#div li a:hover
I followed a tutorial when I first did this and it worked. Then I thought this 
is wrong. There is more then one li and more then one link in the list so I 
changed them to class's and the styling did not work so I had to change them 
back to id's.
I don't understand why, I just know it works and it validated. Is this because 
it is in a list?
Kris
__
css-discuss [cs...@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/


Re: [css-d] id and class selectors

2010-07-21 Thread Philip Taylor (Webmaster, Ret'd)


TriState Advantage, Kris Jacobson wrote:

 Thank you for this article, I found it a good reinforcement of using id's and 
 class's.
 I have a questions on styling lists and links in a div.
 I have been styling lists using id's
 example
 #div ul
 #div li
 #div li a
 #div li a:hover
 I followed a tutorial when I first did this and it worked. Then I thought 
 this is wrong. There is more then one li and more then one link in the list 
 so I changed them to class's and the styling did not work so I had to change 
 them back to id's.
 I don't understand why, I just know it works and it validated. Is this 
 because it is in a list?

Did you change the hashes to periods in the CSS ?
Philip Taylor
__
css-discuss [cs...@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/


Re: [css-d] id and class selectors

2010-07-21 Thread Gabriele Romanato
Kris, you should basically use cascade. For example, if you have a  
structure like this:

div id=test
ul
li/li
!--more--
/ul
div

you can do this:

#test ul {}
#test ul li {}

if you want to apply particular styles to several lis, you can use  
classes. On the contrary, if you want to stylize only one element, use  
an ID.

HTH ^^


http://www.css-zibaldone.com
http://www.css-zibaldone.com/test/  (English)
http://www.css-zibaldone.com/articles/  (English)
http://onwebdev.blogspot.com/  (English)








__
css-discuss [cs...@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/


Re: [css-d] id and class selectors

2010-07-21 Thread Bobby Jack
--- On Wed, 7/21/10, Gabriele Romanato gabriele.roman...@gmail.com wrote:

 Kris, you should basically use
 cascade. For example, if you have a  
 structure like this:
 
 div id=test
 ul
 li/li
 !--more--
 /ul
 div

And you /probably/ shouldn't have a structure like that, since:

ul id=test
li/li
!--more--
/ul

can usually be styled accordingly. YMMV, of course.

- Bobby
__
css-discuss [cs...@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/


Re: [css-d] id and class selectors

2010-07-21 Thread Philippe Wittenbergh

On Jul 22, 2010, at 12:26 AM, Gabriele Romanato wrote:

 Kris, you should basically use cascade. For example, if you have a  
 structure like this:
 
 div id=test
 ul
 li/li
 !--more--
 /ul
 div
 
 you can do this:
 
 #test ul {}
 #test ul li {}

And you certainly can optimise those selectors for better performance and 
simplicity:

#test ul { }
#test li { }
#test a { }

Philippe
---
Philippe Wittenbergh
http://l-c-n.com/





__
css-discuss [cs...@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/