Etiqueta <ol> de HTML

Definição e uso

<ol> A tag define listas ordenadas. As listas ordenadas podem ser numéricas ou alfabéticas.

<li> A tag define cada item da lista.

Dica:Use CSS para definir o estilo da lista.

Dica:Para listas não ordenadas, use: <ul> Tag.

Veja também:

Tutorial de HTML:Lista HTML

Manual de Referência do DOM HTML:Objeto Ol

Tutorial de CSS:Definir o estilo da lista

Exemplo

Exemplo 1

Dois diferentes tipos de listas ordenadas (a primeira lista começa em 1, a segunda em 50):

<ol>
  <li>Coffee</li>
  <li>Tea</li>
  <li>milk</li>
</ol>
<ol start="50">
  <li>Coffee</li>
  <li>Tea</li>
  <li>milk</li>
</ol>

Experimente pessoalmente

Exemplo 2

Definir diferentes tipos de listas (usando CSS):

<ol style="list-style-type:upper-roman">
<li>Coffee</li>
<li>Tea</li>
<li>milk</li>
</ol>
<ol style="list-style-type:lower-alpha">
<li>Coffee</li>
<li>Tea</li>
<li>milk</li>
</ol>

Experimente pessoalmente

Exemplo 3

Exibir todos os tipos diferentes de listas disponíveis usando 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>

Experimente pessoalmente

Example 4

Reduce and expand the line height of the list (using CSS):

<ol style="line-height:80%">
  <li>Coffee</li>
  <li>Tea</li>
  <li>milk</li>
</ol>
<ol style="line-height:180%">
  <li>Coffee</li>
  <li>Tea</li>
  <li>milk</li>
</ol>

Experimente pessoalmente

Example 5

Nested unordered list in an ordered list:

<ol>
  <li>Coffee</li>
  <li>Tea</li>
    <ul>
      <li>Lung Ching</li>
      <li>Pu'er</li>
    </ul>
  </li>
  <li>milk</li>
</ol>

Experimente pessoalmente

Attribute

Attribute Value Description
reversed reversed Define that the list order should be reversed (9,8,7 ...).
start Number Define the starting value of the ordered list.
type
  • 1
  • A
  • a
  • I
  • i
Define o tipo de marcador a ser usado na lista.

Propriedades globais

<ol> A tag também suporta Propriedades globais no HTML.

Propriedades de evento

<ol> A tag também suporta Propriedades de evento no HTML.

Configurações CSS padrão

A maioria dos navegadores usará os seguintes valores padrão para exibir <ol> Elemento:

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

Experimente pessoalmente

Suporte de navegador

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Suporte Suporte Suporte Suporte Suporte