Re: What's wrong with this picture?

by =?iso-8859-1?Q?St=E9phane?= Bergeron <stephberg(at)videotron.ca>

 Date:  Fri, 03 Mar 2000 18:18:23 -0500
 To:  cybrmage(at)dave-world.net,
hwg-techniques(at)hwg.org
 In-Reply-To:  oemcomputer
  todo: View Thread, Original
At 03:00 PM 03/03/00 -0600, Bud Polk wrote:
>I had a second problem. I used a css. I wanted H1, H2, H3 to be a
>certain color. So I put the following in the sylesheet:
>
>
>H1 H2 H3 { color: #8FBC8F;
>}
>
>It didn't work and I ended up using <font color=3D"#8FBC8F"> in the
>tags which defeats the whole purpose of the css.

Hi Bud,

Your CSS wasn't working because the syntax you used is wrong for what you=20
wanted to achieve and it's also invalid in this case.  To achieve what you=
=20
wanted you should write your declaration this way:

H1, H2, H3 { color: #8FBC8F;
}

This is called grouping selectors and you need to add the comas for it to=20
work.  The syntax you wrote is similar to descendant (or contextual)=20
selectors but to my knowledge you can't use 3 elements that way.  That=20
syntax is used when you want your style rule to apply to an element only=20
when it's within another.  For example:

H1 EM {
     color: red;
     font-style: italic;
}

The above would make emphasized text red an italic only when it is inside=20
an H1 tag.  Emphasized text appearing elsewhere in a document would get=20
either the default browser styling or the general styling you might have=20
defined for the EM element in your style sheet.

HTH!

St=E9phane Bergeron

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA