开发者

CSS creating a horizontal navigation bar - `li`s vs. `div`s

开发者 https://www.devze.com 2023-02-19 01:08 出处:网络
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 cont

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

精彩评论

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