Alex Leonard wrote:
i applied a general style to all img on site

eg
#content img {
border: 2px solid #424133;
margin: 20px 10px;}

then in some cases within the #content div, i have been trying to over-ride the general img style with say no border or a different margin, but it does not seem to allow it

ie,
img.subhead {
margin: 40px auto 10px auto;
border: none;
}

and it refuses to change the content. The .subhead img style is below the initial img style in the css.

I have a feeling I am misundertanding the specificty rule, or something to do with descendants.


Well, the problem is one of specificity. The ID is more specific than the class, so #content img is still more specific than img.subhead

Try

#content img.subhead { }

instead of just img.subhead


I know I can get around it by classing all images that I want to have a border as <img class="border"... /> and then giving a img.border {margin:...; border:...;} style.

But as always I prefer to try and understand these things then just work around them. (no point not learning as you go!)

Cheers.

Alex



Hope that helps,
Erik


______________________________________________________________________
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/

Reply via email to