Quantcast
Viewing latest article 2
Browse Latest Browse All 12

Beginner Tutorial: HTML Getting Started

1. The HTML file.

HTML stands for “HyperText Markup Language“. It’s just a sort of plain-text file, something you could create with notepad (Windows), TextEdit (Mac) and more code-oriënted programs like notepad++ and Sublimetext, WebStorm. Don’t use programs like word or wordpad, because those create documents that contain more information then plain-text that is needed for the web. Notepad and most simple editors save text as plain-text by default. Other programs could give more options so then you have to make sure you are saving it as plain-text.

2. Saving an HTML file.

How will we tell the browser that it can interpret the file as HTML? You just have to save the file with an .html extension. For example, filename.html. If you don’t specify that you want to save it as .html then notepad will use .txt. The browser will not be able to open or correctly interpret the file if it doesn’t have .html extension. Sometimes you’ll also see .htm which is also valid. There are other extension in the webpage world, but we don’t cover those in this guide.

3. HTML markup using the tags.

What we do is write plain text and then use markup language to tell the browser how to display or structure the text. Adding markup with HTML means surrounding the “normal text” with tags. Tags are keywords of the HTML language surrounded by <> such as <title>. Ofcourse you don’t have to start writing a lot of text, you can start with a little and begin applying markup. Keep adding text and/or HTML markup as you go.

<title>The Old Man And The Sea</title>

4. Basic HTML file content.

Below you see a code snippet. The colors are of no importance to the HTML code itself, it’s just a way to visualize all parts better. In notepad or TextEdit you’ll see just plain black text on white background if you copy it into a new file. The colors are useful to see the difference between the tags (purple) and generals prose (grey) clearly. I’ll expand more on the parts inside the tags named HTML attributes (like ‘charset’) soon. The prose is Lorem Ipsum generated text, lorem ipsum here.
Feel free to copy it now (you can use the copy function inside the snippet) and paste into notepad. See the following screenshots on how to save it and then opening it inside a browser.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>The Old Man and the Sea</title>
</head>
<body>
 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
     Integer ultricies vehicula misodales lobortis dui accumsan
     porta. Aliquam efficitur eros libero, sed mollis risus
     commodo vel. Nullam ut feugiat leo, eleifend sodales purus.
     Sed sit amet enim maximus.
 </p>
 
 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit
     sodales lobortis dui accumsan porta. Aliquam efficitur 
     commodo vel. Nullam ut feugiat leo, eleifend sodales 
     interdum sem sit amet, lacinia odio. Cras ultrices ultrices 
     id. Cras placerat maximus turpis id bibendum. 
 </p>
</body>
</html>

5. Saving the HTML example and Open in Browser.

In the screenshot below you see the code copied and pasted into notepad. As you see just black and white and no line numbers copied.

Image may be NSFW.
Clik here to view.
html example plain text notepad

In the following screenshot you see me saving the file as a .html file, namely myfirstpage.html. Notepad > File > Save As.

Image may be NSFW.
Clik here to view.
html example saving

To open the file in your browser just double click the .html file when saved or rightclick and choose open. As you can see in the browser, the title “The Old man and the Sea” is not a title inside the page, but it is on top of the page on the upper left side. Below you see the path to the file on my pc. This is just a local path to the file system. If we would publish this online you would see a http web-adress. Inside the browser tab you see 2 paragraphs of prose.

Image may be NSFW.
Clik here to view.
html example in firefox

Next up we’ll start exploring the HTML language and the most commonly used tags to build a webpage from scratch.

Beginner Tutorial: Basic html tags


Viewing latest article 2
Browse Latest Browse All 12

Trending Articles