Click to See Complete Forum and Search --> : [RESOLVED] Id predomminance over class


G-Sun
07-30-2009, 04:40 AM
Hi!

I have a layout for a site, with a little different Layout2.
Like this:

#Main {
margin: 10px;
float: left;
width: 427px;
position: relative;
z-index: 2;
background-color: #F8FAE8;
min-height: 250px;
}
#Main .Lay2 {
width: 650px;
}

The #Main .Lay2 doesn't seem to take effect. Is it overridden because it's a class vs. an id?
Any solution other than making another stylsheet specific for the Layou2 and setting #Main to the desired width?

Thanks!

Kor
07-30-2009, 09:26 AM
You make a confusion.

#Main .Lay2

That means the class Lay2 of the elements nested inside the element with the id="Main". If you need the element with the id="main" and the class="Lay2" you should have written:

#Main.Lay2

Note the white space or the absence of the white space between the selectors

G-Sun
07-30-2009, 10:42 AM
Oh.. thanks! I didn't know it was any difference.
Works now. Thanks!