更新時(shí)間:2022-09-13 09:05:40 來源:動(dòng)力節(jié)點(diǎn) 瀏覽1795次
HTML<ol>標(biāo)簽定義了一個(gè)有序列表。有序列表可以是數(shù)字的或字母的。感興趣的小伙伴可以了解一下HTML標(biāo)簽。
有序列表以<ol>標(biāo)簽開頭。每個(gè)列表項(xiàng)都以<li>標(biāo)記開頭。
默認(rèn)情況下,列表項(xiàng)將用數(shù)字標(biāo)記:
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
標(biāo)簽的type屬性<ol>,定義了列表項(xiàng)標(biāo)記的類型:
| Type | Description |
|---|---|
| type="1" | The list items will be numbered with numbers (default) |
| type="A" | The list items will be numbered with uppercase letters |
| type="a" | The list items will be numbered with lowercase letters |
| type="I" | The list items will be numbered with uppercase roman numbers |
| type="i" | The list items will be numbered with lowercase roman numbers |
數(shù)字:
<ol type="1">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
大寫字母:
<ol type="A">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
小寫字母:
<ol type="a">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
大寫羅馬數(shù)字:
<ol type="I">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
小寫羅馬數(shù)字:
<ol type="i">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
默認(rèn)情況下,有序列表將從 1 開始計(jì)數(shù)。如果要從指定的數(shù)字開始計(jì)數(shù),可以使用該start屬性:
例子
<ol start="50">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
列表可以嵌套(列表中的列表):
例子
<ol>
<li>Coffee</li>
<li>Tea
<ol>
<li>Black tea</li>
<li>Green tea</li>
</ol>
</li>
<li>Milk</li>
</ol>
以上就是關(guān)于“HTML有序列表詳解”的介紹,大家如果對此比較感興趣,想了解更多相關(guān)知識,可以關(guān)注一下動(dòng)力節(jié)點(diǎn)的HTML教程,里面的課程內(nèi)容細(xì)致全面,很適合沒有基礎(chǔ)的小伙伴學(xué)習(xí),希望對大家能夠有所幫助哦。

初級 202925

初級 203221

初級 202629

初級 203743