Hello and welcome back.
This is the second class in a series of tutorials for beginners in web development.
You can access the first one here.
By this point you should have a file named my_site.html with the following code in it:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h4>NASA | JPL</h4>
<h1>ON A MISSION</h1>
<h2>PODCAST</h2>
</body>
</html>
Great!
It is a bit weird having a couple of headings with no further details, isn't it?
Let us add some more text that explains what this whole 'NASA ON A MISSION PODCAST' stuff is about.
For this we will use a different tag, the paragraph tag which opens with '<p>' and closes with a '</p>' .
After the bottom heading, type the following :
<p>A new podcast from NASA</p>
- Click 'File' then 'Save' ( OR hold Ctrl & S together if your are on a windows PC , CMD & S together if you are on a mac ).
- Go to the folder where this file is saved, double click on it to view in your browser.
Cool. Now your website has a paragraph in addition to the headings.
Lets add something more interesting. A list tag.
A list tag in html is used to display lists (pretty obvious huh!).
There are 2 kinds of lists, namely ordered list and unordered list.
An ordered list is simply a numbered list, i.e. a list of things that have a specific order. For example, here is a list of the first 4 months in a year;
- January
- February
- March
- April
On the other hand an unordered list is simply a list that is not numbered, i.e. there is no order to them. For example, here is a list of fruits;
- Mangoes
- Oranges
- Carrots (I refuse to call them vegetables, sue me!)
- Bananas
Got it? Awesome! Now lets add 2 lists to our site.
Open my_site.html in Sublime text (Or whichever text editor you decided to go with) and type the following after the paragraph.
<ul>
<li>Arrival</li>
<li>We Are the World</li>
<li>Worlds of Wonder</li>
</ul>
This is an unordered list, containing items [ Arrival , We Are the World and Worlds of Wonder ].
It starts with an opening tag <ul> (the ul stands for unordered list),
followed by the the items(things) in the list.
Each item(thing) is written inside <li></li> (where li stands for list item).
A list can have as many items as you wish, just remember that each item must be enclosed with the <li></li> tags.
When you are done listing your items, close the unordered list with the closing unordered list tag </ul>.
Below this list, lets add an ordered list.
Type the following after closing the unordered list, in a new line.
<ol>
<li>NASA is cool</li>
<li>Coding comes second, arguably.</li>
<li>What is third place?!</li>
</ol>
This is an ordered list, containing items [ NASA is cool, Coding comes second, arguably and What is third place?! ].
It starts with an opening tag <ol> (the ol stands for ordered list),
followed by the the items(things) in the list.
Each item(thing) is written inside <li></li> (again, li stands for list item).
A list can have as many items as you wish, just remember that each item must be enclosed with the <li></li> tags.
When you are done listing your items, close the ordered list with the closing unordered list tag </ol>.
As you can see, the only difference in how you add an ordered list vs how you add an unordered list is the use of enclosing tags <ol></ol> and <ul></ul> respectively.
Save the file and open it in your browser (you should know how to do this by now).
Notice the difference in how the ordered list is displayed compared to the unordered list below it.
That is it for today, congrats! Play around with the lists by adding your own items (a list of vegetables with carrots in it maybe).
As always, leave a question in the comments section if you have any.
And here is a video you can use to follow up.
Bye for now.
And here is a video you can use to follow up.
Bye for now.
Comments
Post a Comment