ncubica
ncubica

Reputation: 8495

what is the best practices for the markup structure for a pagination?

What should be the best precise markup for a pagination structure? should be tables?, div or span?, simple links or other?

NAV STYLE

<nav>
  <a href="#1">1</a>
  <a href="#1">2</a>
  <a href="#1">3</a>
</nav>

LIST STYLE

<ul>
  <li>1</li>
  <li>2</li>
  <li>3</li>
</ul>

TABLE STYLE or other?

<table>
   <tr>
     <td>1</td>
     <td>2</td>
     <td>3</td>
   </tr>
</table>

I think now we have html5 should be <nav> plus <a> but I'm not sure...

Upvotes: 0

Views: 260

Answers (2)

salezica
salezica

Reputation: 77029

For semantical goodness, use nav as the outer tag. The links should be a tags, but they don't need to be immediate children of nav. You can use lists, tables, or plain links; as long as a tags are found under nav.

Upvotes: 1

Glitch Desire
Glitch Desire

Reputation: 15053

I use:

<nav>
    <ul>
        <li>
            ...
        </li>
    </ul>
</nav>

It makes semantic sense and it's easy to style.

Upvotes: 1

Related Questions