Forum Moderators: open

Message Too Old, No Replies

Div Tags and Xhtml validation

         

mentalacrobatics

3:06 am on Jun 3, 2003 (gmt 0)

10+ Year Member



If I use my <div id="quote"> tag twice in one page and try to validate the site (xhtml transitional) I get the following error: ID "quote" already defined.

This occurs even when the <div id="quote"> tags are at opposite sides of the page.
For example at:
<snip>
If I remove the second set of <div id="quote"> tags the page validates beautifully.

Any ideas as to why this happens?

[edited by: Nick_W at 6:29 am (utc) on June 3, 2003]
[edit reason] no personal urls please / thanks! [/edit]

Edouard_H

3:39 am on Jun 3, 2003 (gmt 0)

10+ Year Member



id should designate one element on a page only. Use <div class="quote"> since the attributes are the same and your page will validate.

mentalacrobatics

4:03 am on Jun 3, 2003 (gmt 0)

10+ Year Member



Thanks a lot! It worked like a charm.
Would it be a problem to have a <div id="quote"> as well as <div class="quote"> in the same css?

drbrain

5:02 pm on Jun 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can give the same name to class and id.

Why are you using <div class="quote">? Why not use the <blockquote> or <cite> elements instead?

mentalacrobatics

5:42 am on Jun 4, 2003 (gmt 0)

10+ Year Member



My full <div class="quote"> is below. I use it to highlight quotes from my writing. Would I be able to achieve the same effect with <blockquote> or <cite>?


#quote {
background-color : #1874cd;
border-bottom : 1px solid #dee3e7;
border-left : 1px solid #dee3e7;
border-right : 1px solid #dee3e7;
border-top : 1px solid #dee3e7;
margin : 12px;
padding-top : 7px;
padding-right : 10px;
padding-bottom : 10px;
padding-left : 10px;
color : #000000;
font : 10px verdana, arial, sans-serif;
letter-spacing : 0;
line-height : 12px;
text-align : justify;
}

drbrain

3:32 pm on Jun 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oops, its <blockquote> and <q>. cite is an attribute used for referencing the source document (my bad).

Yes, just swap the #quote (which is an id, not a class selector) for blockquote or q, whichever is appropriate. blockquote is used for a long quotation (typically multi-line), and q is used for inline quotation.

See: [w3.org...]