| Author |
Preventing inheritance in a Div
|
Rajesh Khan
Ranch Hand
Joined: Oct 16, 2011
Posts: 230
|
|
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
Joined: Nov 16, 2011
Posts: 3
|
|
|
Hmmm well whenever I've used two different labels in one div before. Maybe separate them and see what happens?
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
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
Joined: Jan 10, 2002
Posts: 56230
|
|
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!]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
The CSS2 spec is one of the things sitting on my desk at the moment.
|
 |
Greg Charles
Bartender
Joined: Oct 01, 2001
Posts: 2542
|
|
|
If you start a tag with <label>, you should end it with </label> not </lable>
|
 |
Rajesh Khan
Ranch Hand
Joined: Oct 16, 2011
Posts: 230
|
|
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
Joined: Oct 16, 2011
Posts: 230
|
|
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
Joined: Jan 10, 2002
Posts: 56230
|
|
|
Modern browsers implement most of CSS3.
|
 |
 |
|
|
subject: Preventing inheritance in a Div
|
|
|