trouble with css code

For general web development questions that are not specifically related to CSS HTML Validator. This includes (but is not limited to) general HTML, CSS, Accessibility, JavaScript, and SEO questions.
Post Reply
Cheyenne
Rank III - Intermediate
Posts: 86
Joined: Wed Sep 20, 2006 1:57 pm
Location: CA
Contact:

trouble with css code

Post 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,
User avatar
Lou
Rank V - Professional
Posts: 295
Joined: Fri Jul 29, 2005 5:55 pm
Location: CO
Contact:

Re: trouble with css code

Post 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
Cheyenne
Rank III - Intermediate
Posts: 86
Joined: Wed Sep 20, 2006 1:57 pm
Location: CA
Contact:

Post by Cheyenne »

Thank you, Lou. Will definitely give it a try. :lol: :D

Cheyenne
Post Reply