Original text: http://andymao.com/andy/post/103.html
Previous Section : Unordered ListInformation is sometimes summarized in disorder, while others have a clear order, which was also mentioned in the previous article. So simply think about what things around you have in sequence: operation steps, rankings, book catalogs... In the past, when we faced these contents that were ordered or indicated by numbers, we mostly added a value before the data, or added this value by the program. If you use an ordered list, you don’t need to fill in the ordinal numbers by yourself. This feature does not seem to be obvious when using a single-layer list, but when using multiple layers, its features are very obvious. So let’s first understand the code form of the ordered list:
<ol>
<li>This is the content of the list, this is the first sentence</li>
<li>This is the content of the list, this is the second sentence</li>
<li>This is the content of the list, this is the third sentence</li>
<li>This is the content of the list, this is the fourth sentence</li>
<li>This is the content of the list, this is the fifth sentence</li>
</ol>
Everyone has seen that its original form is the same as that of an unordered list, except that the name is different on the peripheral label. Disorder is UL, and order becomes OL. The difference is that ordered lists will have more label attributes than unordered. Because being ordered will involve all aspects of the order.
Change the start valueUsually, the browser will automatically number it in an orderly manner starting from the Arabic numeral 1. But things are special. When the ordered list needs to be turned into two parts, it is naturally wrong to number the next part from scratch. Then the number of the next part is naturally to add 1 as the start number according to the last number in the previous paragraph. This means we need to change the start value of the list. The attribute that changes the start value is: start, the formal way is:
<ol start=6>
<li>This is the content of the list, this is the first sentence</li>
<li>This is the content of the list, this is the second sentence</li>
<li>This is the content of the list, this is the third sentence</li>
<li>This is the content of the list, this is the fourth sentence</li>
<li>This is the content of the list, this is the fifth sentence</li>
</ol>
You have noticed that the above code says that the starting value of the list starts from 6. So now you can try to add this attribute to an ordered list to see if it has changed?
Change the number typeIn browsers, Arabic numerals are usually listed by default. So can there be other types? Yes, the attribute is type, but there are not many types provided, only five:
Type value Generate style Sequence example A capital letters A, B, C, D, E a lowercase letters a, b, c, c, e I capital Roman numerals I, II, III, IV, V i lowercase Roman numerals i, ii, iii, iv, v 1 Arabic numerals 1, 2, 3, 4, 5
The way to write in the code should be:
<ol type=A>
<li>This is the content of the list, this is the first sentence</li>
<li>This is the content of the list, this is the second sentence</li>
<li>This is the content of the list, this is the third sentence</li>
<li>This is the content of the list, this is the fourth sentence</li>
<li>This is the content of the list, this is the fifth sentence</li>
</ol>
I think it is better to use less value of this type, because you can set this type using CSS. I have always advocated that style things should be done by style language. Then, unless there is a special reason, it is better not to use this attribute. Of course, neither CSS1 nor CSS2 basically considered China. Japanese-numbered characters have been provided in CSS2, but there is no Chinese yet. I think CSS2 still has flaws in this regard, at least it does not provide a better form of expansion. Although he did not provide it, we can still achieve diversity in our own form. How to do it? Please think first, the style content of the list will tell you how I handled it.