views:

31

answers:

2

I have a dl that I've coded like so:

<dl>
  <dt>term 1</dt>
    <dd>definition 1</dd>
  <dt>term 2</dt>
    <dd>definition 2</dd>
  <dt>term 3</dt>
    <dd>definition 3</dd>
</dl>

I'm finding it hard to apply the right css for the layout that i want ie. each term and definition in a column. structuring the html in the following way would solve my problem but I am wondering, is this ok? (from an accessibility point of view).

<dl>
    <dt>term 1</dt>
    <dd>definition 1</dd>
</dl>
<dl>
    <dt>term 2</dt>
    <dd>definition 2</dd>
</dl>
<dl>
    <dt>term 3</dt>
    <dd>definition 3</dd>
</dl>

cheers, Pete

A: 

It seems it's not fully semantic (http://www.w3schools.com/tags/tag_dl.asp) but nobody wants to worry ^^ You can say you have many lists of one definition !

MatTheCat
It's not semantically correct as MatTheCat said, but I won't tell anyone.
Tyler
+1  A: 

Putting each term in its own list makes it impossible to determine programmatically that the three terms are actually related to each other (in that they're part of the same bit of content on your site). Deviating from standards is certainly necessary from time to time, but you've said nothing that demonstrates that it's necessary here.

If your original underlying problem is "I can't get this list styled the way I want," perhaps a better question for Stack Overflow is: "How can I style this list to look like __."

VoteyDisciple
It would make sense to keep the list as one because the terms are related to each other.
pete
Exactly. You don't really have three different lists; you have one list with three different terms. Any other markup is incorrect. Again, that's not to say incorrect markup can absolutely **never** be used; but it is incorrect.
VoteyDisciple
It would make sense to keep the list as one because the terms are related to each other. so i need to get help with the css.... I'll have to post it as another question as it seems i can't add code here.... cheers guys
pete
@Pete: you should be able to edit your question above?
Paul D. Waite