What is the best practice for linking dl list items (Definition lists)
<dl>
<dt>link title 1</dt>
<dd>link description 1</dd>
<dt>link title 2</dt>
<dd>link description 2</dd>
</dl>
linked(?):
<dl>
<a href="#">
<dt>link title 1</dt>
<dd>link description 1</dd>
</a>
<a href="#">
<dt>link title 2</dt>
<dd>link description 2</dd>
</a>
</dl>
or would you use <li>
and <br>
tags to achieve a similar thing.
<ul>
<li><a href="#">link title 1<br><span class="description">link description 1</span></a></li>
<li><a href="#">link title 2<br><span class="description">link description 2</span></a></li>
</ul>
This is for what is to become part of a mobile app (via phone gap) any help or insight would be brilliant, thanks.
You should not use a
tag as direct child of dl
. The dd
and dt
tags are used as direct child. So, you can use:
<dl>
<dt><a href="#">link title 1</a></dt>
<dd><a href="#">link description 1</a></dd>
<dt><a href="#">link title 2</a></dt>
<dd><a href="#">link description 3</a></dd>
</dl>
This way you maintain the standard of html.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With