Tanda <ol> HTML
- Halaman sebelumnya <object>
- Halaman berikutnya <optgroup>
定义和用法
<ol>
标签定义有序列表。有序列表可以是数字或字母顺序。
<li> 标签用于定义每个列表项。
提示:请使用 CSS 来设置列表样式。
提示:对于无序列表,请使用 <ul> 标签.
另请参阅:
HTML 教程:Senarai HTML
HTML DOM 参考手册:Ol 对象
CSS 教程:设置列表的样式
实例
例子 1
两个不同的有序列表(第一个列表从 1 开始,第二个从 50 开始):
<ol> <li> kopi </li> <li> teh </li> <li> susu </li> </ol> <ol start="50"> <li> kopi </li> <li> teh </li> <li> susu </li> </ol>
例子 2
设置不同的列表类型(使用 CSS):
<ol style="list-style-type:upper-roman"> <li> kopi </li> <li> teh </li> <li> susu </li> </ol> <ol style="list-style-type:lower-alpha"> <li> kopi </li> <li> teh </li> <li> susu </li> </ol>
例子 3
通过 CSS 显示可用的所有不同列表类型:
<style> ol.a {list-style-type: armenian;} ol.b {list-style-type: cjk-ideographic;} ol.c {list-style-type: decimal;} ol.d {list-style-type: decimal-leading-zero;} ol.e {list-style-type: georgian;} ol.f {list-style-type: hebrew;} ol.g {list-style-type: hiragana;} ol.h {list-style-type: hiragana-iroha;} ol.i {list-style-type: katakana;} ol.j {list-style-type: katakana-iroha;} ol.k {list-style-type: lower-alpha;} ol.l {list-style-type: lower-greek;} ol.m {list-style-type: lower-latin;} ol.n {list-style-type: lower-roman;} ol.o {list-style-type: upper-alpha;} ol.p {list-style-type: upper-latin;} ol.q {list-style-type: upper-roman;} ol.r {list-style-type: none;} ol.s {list-style-type: inherit;} </style>
contoh 4
menurunkan dan memperbesar tinggi baris dalam senarai (gunakan CSS):
<ol style="line-height:80%"> <li> kopi </li> <li> teh </li> <li> susu </li> </ol> <ol style="line-height:180%"> <li> kopi </li> <li> teh </li> <li> susu </li> </ol>
contoh 5
masukkan senarai tak berurutan ke dalam senarai berurutan:
<ol> <li> kopi </li> <li> teh </li> <ul> <li> Longjing </li> <li> Puer </li> </ul> </li> <li> susu </li> </ol>
aturan
aturan | nilai | dekripsi |
---|---|---|
terbalik | terbalik | mentakikira urutan senarai patut di balikkan (9,8,7 ...). |
mulai | nombor | mentakikira nilai permulaan senarai berurutan. |
type |
|
Menentukan jenis tanda yang akan digunakan dalam senarai. |
Properti global
<ol>
Tanda masih mendukung Properti global HTML.
Sifat acara
<ol>
Tanda masih mendukung Sifat acara HTML.
Pengaturan CSS baku
Bersamaan dengan kebanyakan pereka, pereka akan menggunakan nilai baku berikut untuk paparan. <ol>
Elemen:
ol { display: block; list-style-type: decimal; margin-top: 1em; margin-bottom: 1em; margin-left: 0; margin-right: 0; padding-left: 40px; }
Pendukung pereka
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Dukungan | Dukungan | Dukungan | Dukungan | Dukungan |
- Halaman sebelumnya <object>
- Halaman berikutnya <optgroup>