> 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;
> }
>
> I have a feeling I am misundertanding the specificty rule

Correct. Have a look at
http://www.w3.org/TR/CSS21/cascade.html#specificity
(and then allow your brain to cool down :-)

Basically, your id and element selector "#content img" gets a score of
101, and your class and element selector "img.subhead" gets a score 11, so
the first rule wins.

To get the effect you want, either change your second selector to
"#content img.subhead", or (if you want all images to get the first rule
by default) take out the #content in the first selector - after all, if
you want all images to get the styles, there's no need to mention the
#content element at all.

HTH,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/
______________________________________________________________________
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