Page 1 of 1

trouble with css code

Posted: Fri Feb 23, 2007 6:58 pm
by Cheyenne
I have many <p>'s on one page of the website I am working on.

I want some <p>'s to be gold and some white.

I do have the correct coding for the colors.

I am using a CSS.

In CSS
p { font-family: Helvetica, 'lucida sans', sans-serif; color: #f8f8ff }

For the <p>'s I want to appear gold, I assigned this code:
#wdg97 { font-family: Helvetica, 'Lucida sans', sans-serif; color: #ffd700 }


on the webpage, the first time I entered <p id="wdg97", the Validator Pro accepted it.

Thereafter, when I put the code in described above, The Validator says
The "id" or "name" attribute value "wdg97" has already been used in this document. A tag's "id" or "name" value ("name" only for certain elements such as "a") must be unique within the document. A tag cannot have an "id" or, with certain elements, a "name" attribute value that has already been used. Note that the "id" values are not case sensitive (except when used to link to an anchor) and that "id" and some "name" attribute values share the same namespace.

So, how do I get the rest of the <p>'s to appear gold?

I am going to put the website on through WSFTP. The page I am working on is http://www.alphateq.net/howdoi.html. Can you check the source to see what I mean in here, please?


Thank you,

Re: trouble with css code

Posted: Fri Feb 23, 2007 7:43 pm
by Lou
Cheyenne wrote:
on the webpage, the first time I entered <p id="wdg97", the Validator Pro accepted it.
I think you need to use class= instead of id=

I would set up 2 class

p.white { font-family: Helvetica, 'lucida sans', sans-serif; color: #f8f8ff }

p.gold { font-family: Helvetica, 'Lucida sans', sans-serif; color: #ffd700 }

Then use
<p class = "white" or <p class = "gold"

Lou

Posted: Sat Feb 24, 2007 10:10 am
by Cheyenne
Thank you, Lou. Will definitely give it a try. :lol: :D

Cheyenne