This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Preventing inheritance in a Div

 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i have a div inside another div as follows


Now the problem is what ever i apply to label also affects the label inside ClassA. Is there any way in which i could explicitly specify that the style should only be applied to the label whose direct parent is ClassA at the same time keeping classb inside classA
 
Elisabeth Barton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm well whenever I've used two different labels in one div before. Maybe separate them and see what happens?
 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The CSS selector "E F" matches any F element which is a descendant of an E element. The selector "E>F" matches any F element which is a child of an E element. (I got this directly from the CSS specification.) Was that what you had in mind?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64712
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your reference table for CSS3 selectors give you any clue?

(If you don't have one handy, now you know what your next task is.)

[Edit: Oh man, Paul snuck in before me!]
 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The CSS2 spec is one of the things sitting on my desk at the moment.
 
Greg Charles
Sheriff
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you start a tag with <label>, you should end it with </label> not </lable>
 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Charles wrote:If you start a tag with <label>, you should end it with </label> not </lable>

Thanks for pointing that out
 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys i didn't know there were so many possibilities
http://www.w3.org/TR/CSS2/selector.html#class-html
I could have just used
.classA > label {color:Blue;background-color:Red}
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64712
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Modern browsers implement most of CSS3.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic