Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linking definition lists (best practice) or bad idea?

Tags:

html

css

list

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.

like image 265
Benjamin Avatar asked Oct 19 '22 17:10

Benjamin


1 Answers

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.

like image 127
Bhojendra Rauniyar Avatar answered Oct 22 '22 21:10

Bhojendra Rauniyar