Difference between HTML ul and ol

 Item tags commonly used in HTML are <ul></ul> and <ol></ol>. Both of them are matched with <li></li> tags, and they have almost the same writing rules. , The difference lies in whether there is a function of automatically sorting items. The <ul></ul> tag defaults to only a bullet with a black dot, similar to "●", which may present different effects in different browsers, and < The ol></ol> tag has the function of numerical sorting, that is, there will be a number displayed in front of each item by default, starting from 1 in order.


HTML ul and ol basic writing
<ul>
 <li>...Project content...</li>
</ul>
<ol>
 <li>...Project content...</li>
</ul>

Whether it is <ul></ul> or <ol></ol>, the rules for writing are the same. Use <li for each item ></li> Wrap up tags, the entire group of <ul></ul> or <ol></ol> tag groups can have unlimited <li></li> item tags, but please be aware of too many Projects can lead to slow processing. For example, 2000 projects are a bit too much, and in general, they don’t need so many.

HTML ul and ol example reference
<ul>
 <li>Monday</li>
 <li>Tuesday</li>
</ul>
<ol>
 <li>Monday</li>
 <li>Tuesday</li>
</ul>
The output of the above example is
  • Monday
  • Tuesday
  1. Monday
  2. Tuesday
From the example, you can see that HTML's <ul></ul> and <ol></ol> these two project tags have exactly the same writing rules, but the final results presented are quite different. If this article If you need to show the effect of sorting items, use the <ol></ol> tag. If you don’t need to sort, just use the <ul></ul> tag.

Post a Comment

0 Comments