Isn't
<p>
1. a
2. b
3. c
</p>
easier to write than
<ol>
<li>a </li>
<li>b </li>
<li>c </li>
</ol>
?
An organized list is very useful for sorting and accessibility. Not only that, but the example you just showed wouldn't 'stack' the way you would expect. And lastly, organized lists can be styled differently and uniquely to other structures using CSS. Basically its better in all ways to use them.
Related:
Are <ol> and <ul> the exact same thing?
Edit: Ah, numbers and bullets.
unordered lists use bullets, ordered lists use numbers
In addition to the above points, when you add a new li to a list, or reorder them, that's all you need to do; when you're doing the numbering manually you have to update every item. Easy when there's 3 items, but when there's hundreds it's a lot more time consuming.
Better for semantics I think.
OL implies an element is dependant on other elements for it's context.
That and it is easier and neater.
now color every other item grey in your p example
[QUOTE=Shadaez;45663037]now color every other item grey in your p example[/QUOTE]
I see your point, although the span tag with classes makes this doable.
Although I now see the use in it.
so you'd do
<span>1</span>
<span>2</span>
<span>3</span>
instead? of course it's possible, but using the list tags also explains what the content is and groups it in a meaningful way
It's nice for getting the numbers automatically as has been mentioned, but the main reason is for semantics. HTML is a language that is designed to add meaningful descriptions to text through markup first and foremost, and that's exactly what the ol tag does.
Thanks everyone‼
also very useful when generating lists via ajax etc
I know this thread might be done but here's an answer anyways :-
HTML tags have been made for a specific purpose : semantics i.e. they explain the meaning of the content that occurs between the opening and the closing tag.
So using <p> Your_List_Here </p> and <ul>Your_List_Here </ul> may look the same but they will not mean the same. The browser will interpret them as different - the first as a paragraph and the second as a list.
So if you want the thing to be a list, use <ul>/<li> combo or <dd>/<dt><dl> combo or <ol>/<li> combo, whichever suits your purpose. All three lists have different interpretations, of course.
Hope this helps.
Depending on how you look at it,
<p><li></li></p> is incorrect HTML. You can not use <ul> without <li> and you can not use <li> without <ul>, <ol>, <dir> or <menu> (according to [url]http://ss.rubensrv.nl/i/1377St.png[/url])
<p class="ol">
<div><span>1.</span> List item</div>
<div><span>2.</span> List item</div>
<div><span>3.</span> List item</div>
</p>
Sorry, you need to Log In to post a reply to this thread.