Forum Moderators: open

Message Too Old, No Replies

<div> allowed within a list?

it appears to work, but...

         

borad

9:48 am on Feb 21, 2003 (gmt 0)

10+ Year Member



I've got a page which is a glossary, and hence a definition list is most of it. At a number of points I want to include a pic and a little bit of attached text, so I included some floating <div>s on the right. it appears to work well in a number of browsers, but when i go to validate it at W3C, no go. I get:

"document type does not allow element "div" here; assuming missing "dd" start-tag"

anyone suggest a solution/alternative method (CSS based)? lists are a block, not inline, element, right, so I don't understand the objection.

Nick_W

9:52 am on Feb 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A little minimal emample code?

Nick

borad

10:12 am on Feb 21, 2003 (gmt 0)

10+ Year Member



<dl>
<dt>
word
<div class="thumbnail">
<img src="pics/a.gif" />
<br />
caption
</div>
</dt>
<dd>
definition
</dd>
...
</dl>

and in the stylesheet:

div.thumbnail {
float: right;
width: 200px;
text-align: center;
}

Nick_W

10:39 am on Feb 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try puttin the div inside a <dd>, that should do it. The CSS won't make any difference but, I'll bet the html will now validate.

Nick

borad

11:12 am on Feb 21, 2003 (gmt 0)

10+ Year Member



Bingo!

Is there any particularly logical reason for this? :)

BlobFisk

11:45 am on Feb 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



DT is the definition title as it were and may only contain text-level markup. The DD is the actual definition and can contain block level elements and markup.