For this, you will need a browser and a text editor.
If you have a laptop or desktop, then you probably already have a browser installed ( Internet Explorer or Microsoft Edge if you are on Windows, Safari if you are on a mac ).
By now, you probably know that a browser is simply a software used for browsing the internet.
Another software you will need for this class, is a text editor. This allows you to write your code.
I recommend using sublime text (get it here).
Great! Now your are ready to begin your "front end web development" (or simply, creating websites) journey.
- In your desktop (or anywhere you prefer saving your work) , create a folder myProjects. Inside this folder, create another folder and call it html.
- Open up sublime text and click 'file' (top left), then click 'new file' , then click 'file' again and this time click 'save as'.
- On the window that appears, go to the 'html' folder you just created.
- Under 'file name', type my_site.html.
- Make sure it says 'all files' under 'save as type' (if not, then click the drop down list and select HTML(*.html ...) ) and click save.
At this point this is what you need to know about html.
- HTML stands for hypertext markup language(knowing this will help you speak better with "experienced" web developers).
- Any website is made of content (text, images, videos and audios, as well as links to other webpages) and HTML is a way for you to specify how the browser should display the content.
Consider the image below:
In the image above, we can say that there is a main heading which is ON A MISSION , a smaller heading at the bottom i.e. 'PODCAST' and another at the top i.e. NASA | JPL .
There is also a pretty cool background image.
Ignoring the image (for now), all the headings, large or smaller are simply text (a bunch of letters). We refer to them as headings because we 'know/think' them to be so. Similarly, we can tell a browser that certain text is a heading and even specify how small or large it should be.
Let's do that now.
- In the sublime file you just created (and named my_site.html), start typing <htm
- A popup should appear saying html, click enter, and the following html code shall be added for you (thanks Sublime).
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
- If the code does not appear, then you will have to type the above code yourself (or if you are lazy like a true programmer should be, just copy and paste it).
- Ignoring most parts of the code, let's jump into the <body></body> portion.
- Everything you want to display in your website goes inside the body tags.
- A tag in html, is any element that is surrounded by the < and > characters. So, <html> , <head> , <title> and <body> are all tags. You will learn many more later on.
- Most tags are opened and closed. < > specifies the opening of a tag while </ > specifies the closing of a tag.
- Inside the body tag, type the three headings in the image above as follows:
<body>
<h2>NASA | JPL</h2>
<h1>ON A MISSION</h1>
<h4>PODCAST</h4>
</body>
<h2>NASA | JPL</h2>
<h1>ON A MISSION</h1>
<h4>PODCAST</h4>
</body>
- Click 'file' then 'save'. Go to html folder where this file is saved and double click to open it in a browser ( you may need to right click and choose open with, then select a browser you prefer ).
Congrats! You just created your first website.
At this point, it is just a simple website with three headings.
Let's wrap today's lesson by discussing how html displays headings.
Looking at your html code (in sublime or whatever text editor you decided to use) and the output (in your browser), note the following;
- the middle heading, ON A MISSION looks larger than the other two.
- the bottom heading is the smallest of all.
- The tags (<body> , <h4> , etc) are not appearing, only the text inside them.
The browser uses the html tags to understand how to display the text. The tags themselves are not displayed.
To display a heading,
tags <h1></h1>, <h2></h2>, <h3></h3>, <h4></h4>, <h5></h5> and <h6></h6> are used.
We are only using three of these in our site.
Notice that, the larger the number following the <h, the smaller in size the heading appears. That is surrounding text with <h1></h1> will make the text appear as a larger heading compared to using <h2></h2>, which is larger than <h3></h3> and so on.
That's it for today!
Your site does not look like the image above yet, but that's okay.
Play around with the headings, changing h1 to h3 for example, then save and view the output in your browser.
Comments
Post a Comment