导航
×
   ❮   
HTML CSS JavaScript PHP Go Sass W3C Colors ECMS

HTML 参考手册

HTML 元素(功能排序) HTML 浏览器支持 HTML 属性 HTML 全局属性 HTML 事件 HTML 颜色 HTML 画布 HTML 音频/视频 HTML 字符集 HTML 文档类型 HTML URL 编码 HTML 语言代码 HTML 国家代码 HTTP 状态消息 HTTP 请求方法 PX-EM 转换 键盘快捷键

HTML 标签

<!--> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <data> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <h1> - <h6> <head> <header> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <main> <map> <mark> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <picture> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <svg> <table> <tbody> <td> <template> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>

HTML <ol> 标签


实例

两个不同的有序列表(第一个列表从1开始,第二个列表从50开始):

<ol>
  <li>咖啡</li>
  <li>茶</li>
  <li>牛奶</li>
</ol>
 
<ol start="50">
  <li>咖啡</li>
  <li>茶</li>
  <li>牛奶</li>
</ol>
亲自试一试 »

下面有更多实例。


定义和用法

<ol> 标签定义了一个有序列表. 列表排序以数字来显示。

<li> 标签用于定义每个列表项。

提示: 使用CSS设置 列表样式

提示: 对于无序列表,使用 <ul> 标签。


浏览器支持

元素          
<ol> Yes Yes Yes Yes Yes

属性

属性 描述
reversed reversed >指定列表倒序(9,8,7...)
start number 一个整数值属性,指定了列表编号的起始值。
type
  • a 表示小写英文字母编号
  • A 表示大写英文字母编号
  • i 表示小写罗马数字编号
  • I 表示大写罗马数字编号
  • 1 表示数字编号(默认)
规定列表的类型。不赞成使用。请使用样式代替。

全局属性

<ol> 标签支持 HTML 中的全局属性


事件属性

<ol> 标签支持 HTML 中的事件属性


更多实例

实例

设置不同的列表类型 (使用 CSS):

   <ol style="list-style-type:upper-roman">
<li>咖啡</li>
<li>茶</li>
   <li>牛奶</li>
</ol>

<ol style="list-style-type:lower-alpha">
   <li>咖啡</li>
<li>茶</li>
<li>牛奶</li>
</ol>
亲自试一试 »

实例

显示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>
亲自试一试 »

实例

减少和扩展列表中的行高度 (使用 CSS):

   <ol style="line-height:80%">
 <li>咖啡</li>
     <li>茶</li>
 <li>牛奶</li>
</ol>

<ol     style="line-height:180%">
 <li>咖啡</li>
 <li>茶</li>
     <li>牛奶</li>
</ol>
亲自试一试 »

实例

将无序列表嵌套在有序列表中:

   <ol>
 <li>咖啡</li>
 <li>Tea
   <ul>
         <li>红茶</li>
     <li>绿茶</li>
       </ul>
 </li>
 <li>牛奶</li>
</ol>
亲自试一试 »

相关页面

HTML 教程: HTML Lists

HTML DOM 参考手册: Ol 对象

CSS 教程: Styling Lists


默认CSS设置

大多数浏览器将使用以下默认值显示 <ol> 元素:

实例

    ol {
  display: block;
  list-style-type: decimal;
  margin-top: 1em;
      margin-bottom: 1em;
  margin-left: 0;
  margin-right: 0;
      padding-left: 40px;
} 
亲自试一试 »

Copyright ©2020-2026 freew3c.com All Rights Reserved 提供的内容仅用于学习和测试,不保证内容的正确性。