Skip to main content

HTML BASICS : CLASS 102

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;
  1. January
  2. February
  3. March
  4. 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.



Comments

Popular posts from this blog

HTML BASICS : CLASS 109 part II

Hello and welcome back. In part I , we learned the theory behind the html div ta g and the form elements . We have quiet some coding to do in this part, so let's get to it. Create a new html file and name it sections.html . Open the file in your text editor (e.g. Sublime Text), type in the following code and save it. You can go ahead and view it on your browser afterwards, though it won't look quiet good just yet. <!DOCTYPE html> <html> <head>     <title></title>     <link rel="stylesheet" type="text/css" href="sections.css"> </head> <body>     <div id="header">         <h2>My Site</h2>     </div>     <div id="content">         <div id="main">             <p>Welcome to my website.<br>Please give me your feed...

CSS BASICS : CLASS 106

Hello and welcome back to this tutorial series for beginners in web development. This tutorial assumes you grasped all concepts discussed in the previous 5 html classes. You can test yourself using the exercise given here . At this point, your my_site.html file should have the following code in it.  <!DOCTYPE html> <html> <head>     <title></title> </head> <body>     <h2>NASA | JPL</h2>     <h1>ON A MISSION</h1>     <h4>PODCAST</h4>     <p>A new podcast from NASA</p>     <ul>         <li>Arrival</li>         <li>We Are the World</li>         <li>Worlds of Wonder</li>     </ul>      <ol>  ...