2

I think very often tabs are implemented as <ul> and a series of <li> inside. Is there advantage of that over just using <div> with a few <div>s inside?

Usually with <ul> as tabs, the padding-left of it needs to be reset to 0, and list-style needs to be set to none, while <div> doesn't have this issue.

nonopolarity
  • 146,324
  • 131
  • 460
  • 740
  • Already discussed? http://stackoverflow.com/questions/549689/why-should-i-use-li-instead-of-div – thmshd Apr 04 '11 at 21:11

3 Answers3

1

Looks better when CSS isn’t applied, and is (I believe) easier to interact with in screen-readers.

Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
1

Short and clear answer: Why should I use 'li' instead of 'div'?

Excerpt:

"For semantic correctness. HTML has the ability to express lists of things, and it helps the Google robot, screen readers, and all manner of users who don't care solely about the presentation of the site understand your content better."

"For the visually impaired, it can be helpful to distinguish what's in a list and what's not. Say if you have a list of ingredients in a recipe for example, and the user wants to skip to the instructions or just read the list, you need a list."

Don't forget to visit the link to learn more.

Kostas Minaidis
  • 4,681
  • 3
  • 17
  • 25
thmshd
  • 5,729
  • 3
  • 39
  • 67
0

In terms of adding/changing the code, it is more readable and makes more sense. Tabs/navigation naturally seem like a list where the items are associated with each other.

Once implemented via CSS, it is extremely easy to add/modify when the time comes to change your navigation/tabs.

Mike Lewis
  • 63,433
  • 20
  • 141
  • 111
  • @Kyle: not to speak for Mike, but a) the tag names are shorter, and b) the list as a whole (`
      `, `
      ` or, in HTML5, `
    – Paul D. Waite Apr 04 '11 at 21:31