Saltar al contenido principal
← 📄 HTML & the platform·Módulo A4 · Lección 3
TareaBuild two lists. <ol> with 3 steps: 'Boil water', 'Add tea', 'Wait'. <ul> with 3 properties: 'Quick', 'Vegan', 'Cheap'.

<ul> vs <ol>: cuando el orden importa

50 XP4 min
Teoría

The semantic test

  • `<ul>` — unordered. The user wouldn't be confused if you shuffled the items. (Tags, ingredients, navigation links, features.)
  • `<ol>` — ordered. Reordering would break meaning. (Steps in a recipe, race results, top-10 lists.)
<ol>
  <li>Boil water</li>
  <li>Add tea</li>
  <li>Wait 4 minutes</li>
</ol>

<ul>
  <li>Vegan</li>
  <li>Quick</li>
  <li>Cheap</li>
</ul>

Screen readers announce "ordered list, 3 items" vs "list, 3 items" — they let blind users know whether step-by-step navigation matters.

<ol> attributes worth knowing

<ol start="5">             <!-- start numbering from 5 -->
<ol reversed>              <!-- count down: 3, 2, 1 -->
<ol type="A">              <!-- A, B, C — or "a", "i", "I" -->
<ol type="1" start="42">

For "top 10" lists with custom styling, use <ol reversed start="10"> so the largest number shows first.

Nested lists

<ul>
  <li>Frontend
    <ul>
      <li>HTML</li>
      <li>CSS</li>
      <li>JS</li>
    </ul>
  </li>
  <li>Backend</li>
</ul>

The nested <ul> goes INSIDE the parent <li>, not between them. Common mistake: putting it outside the <li> (which is invalid HTML).

🔒

Regístrate para empezar a programar

La teoría está abierta a todos. El editor, la vista previa y el check se desbloquean con una prueba gratis de 7 días — se requiere tarjeta, cancela cuando quieras.

Registrarse — prueba gratis →

Las primeras 10 lecciones de cada ruta son gratis. No se necesita tarjeta.

← AnteriorSiguiente lección →

Recibe un consejo de Python o web al día — por email

Corto, escrito a mano, sin spam. Anula la suscripción en un clic.