javascript - Markup for tabbed interfaces -


i checked out couple solutions tabbed interfaces (including jquery ui), , markup follows same ul-li-a pattern:

<ul class="tabs"> <li><a href="#tab1">title 1</a></li> <li><a href="#tab2">title 2</a></li> </ul> 

is considered best practice, , why? far have used span or div tags, , worked fine. also, why "a" tags? here trigger hover , active states on older browsers?

it's semantic markup several reasons:

  1. it unordered list of stuff, namely title 1, title 2 etc.

  2. if javascript disabled, have div elements ids of tab1 , tab2 in markup, links behave correctly , send right div.

  3. it makes tabs accessible.

and there lot of reasons using semantic html.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -