CSS creating a horizontal navigation bar - `li`s vs. `div`s
Which is the semantically better way to do this? Floating li
elements inside a ul
or just float div
s inside an 'outer' d开发者_开发技巧iv?
Using a list would be more semantically correct, as the content represents a list of navigation items. Divs are just division/placeholder containers, often used for styling.
For html4 use a list as Mic said.
For new html5 there is a <nav>
element to wrap your list in, which is semanticaly better.
<nav>
<ul>
<li><a href="#">Menu item</a></li>
</ul>
</nav>
精彩评论