Lists
In HTML we have two kinds of lists, ordered and unordered. The difference being that the ordered use numbers, while the unordered uses bullets. You create a list by writing the opening and closing tags, and inside them you write your list elements <li>List element</li>
. The list element tag is common for ordered and unordered lists.
An ordered list is enclosed in the <ol></ol>
element. You write an ordered list as such:
... which gives the following output:
List element
List elementer
Even list elementer
List elementest
The unordered list is enclosed in the <ul></ul>
element. You write an unordered list as such:
... which gives the following output:
List element
List elementer
Even list elementer
List elementest
You can also have a nested list, both in ordered and unordered lists. To do this you create another list within a list element. E.g. for an ordered list you will write:
This will give:
List element
List within a list
Look at this list
It is within another list
I'm just a regular list element
Notice how "List within a list" have a opening tag in front of it, but not a closing tag after it. That is because the list element is closed after the sublist is written.
You can change <ol>
to <ul>
to get an unordered list. You can also mix list types, just remember to open and close with the same tags.
Last updated
Was this helpful?