开发者

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 divs 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜