Coding a List
29 March 2019
Coding a list, how would you go about doing it? One way to do it is to put 1.nanana 2. nannaan... etc but if you want to put the list horizontal or give it a name so you could link to it etc, there is a special way to do it.
The tag is the ul (unordered) tag for a bullet point list, or the ol (ordered) tag for a numbered tag. When you write these tags,
you have to do this:
<ul> <li> Bag of tomatoes </li> <li> Sack of potatoes</li> </ul>
That looks like this:
1. Bag of Tomatoes
2.Sack of Potatoes
This way of writing lists may look time consuming to you, but if you wanted to put a different background color on your list then this would be easier than giving it a class...etc
(we'll learn about that later)
TIPS
For those of you that are finding it hard to remember to close your tags. Just remember that when you open a bracket or quotation marks in
normal writing you have to close it otherwise it won't make sense, right? Well it's the same thing with these HTML tags. You have to close them otherwise the computer
won't be able to read it properly.
HOMEWORK
1.Write a shopping list in HTML on the Khan Academy webpage editor
2.Show your shopping list to your parents and hide the code. Ask them how they think you did it.
3.They will probably be surprised when you tell them how!
NEXT POST →
Any Questions?
Any Questions?