I found that quite a few "toolbar" in web page is implemented with HTML tag UL and LI with style "float:left".
Fore example, with the help of FireBug it is easy to find this pattern in http://www.yahoo.com/.
Is there any reason for that? I don't think that UL and LI are invented to create toolbar.
Using li and ul is not only more semantic, but it gives meaning to the html nodes, helping screen readers, web crawlers, etc. Questions like this tend to cause discussions, presentation of opinions, and abstract arguments (e.g., about something being “semantic”), rather than technical answers based on facts.
HTML 4.01 Unordered lists (UL), ordered lists (OL), and list items (LI) HTML 4.01 Definition lists: the DL, DT, and DD elements.
If you just use <li></li> without <ul> or <ol> the rendered result will be a un ordered list with bullet icons preceding each list item, and when you see the DOM there won't be any <ul> or <li> tag added.
The <ul> HTML element represents an unordered list of items, typically rendered as a bulleted list.
HTML was intended for semantics (what things mean), not presentation (what they look like). Since <ul>
represents an unordered list, and since a toolbar is conceptually just a list of items, this is sensible. Even StackOverflow does it!
<div class="nav">
<ul>
<li><a href="/questions">Questions</a></li>
<li><a href="/tags">Tags</a></li>
<li><a href="/users">Users</a></li>
<li><a href="/badges">Badges</a></li>
<li><a href="/unanswered">Unanswered</a></li>
</ul>
</div>
UL
and LI
are for lists. And you are listing a bunch of links (sub-navigation, tools(?), etc.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With