HTML For Absolute Beginners

Welcome to the HTML.com’s plain and simple guide to basic HTML code.

While many guides on the internet attempt to teach HTML using a lot of mind-boggling theory, this tutorial will instead focus on giving you the practical skills to build your first site.

The aim is to show you ‘how’ to create your first web page without spending the entire tutorial focusing too much on the ‘why’. By the end of this tutorial, you will have the know-how to create a basic website and we hope that this will inspire you to delve further into the world of HTML using our follow-on guides.

What is HTML?

Ok, so this is the only bit of mandatory theory. In order to begin to write HTML, it helps if you know what you are writing. HTML is the language in which most websites are written. HTML is used to create pages and make them functional. The code used to make them visually appealing is known as CSS and we shall focus on this in a later tutorial. For now, we will focus on teaching you how to build rather than design.

Background Facts

HTML was first created by Tim Berners-Lee in 1990. The latest version is known as HTML 5.

It stands for Hyper Text Markup Language.

Hypertext means that the document contains links that allow the reader to jump to other places in the document or to another document altogether.

A Markup Language is a way that computers speak to each other to control how text is processed and presented.  To do this HTML uses two things: tags  and attributes.

What are Tags and Attributes?

Tags:

Tags are used to mark up the start of an HTML element and they are usually enclosed in angle brackets. An example of a tag is: <h1>.

Most tags must be opened  <h1>  and closed </h1> in order to function

Attributes

Attributes contain additional pieces of information. Attributes take the form of an opening tag and additional info is placed inside.

An example of an attribute is:

<img src="mydog.gif" alt="A photo of my dog.">.

In this instance, the image source (src) and the alt text  (alt) are attributes of the <img> tag.

Rules You Must Remember Before Starting

  1. The vast majority of tags must be opened <Tag> and closed </Tag> with the element information such as a title or text resting between the tags.
  2. When using multiple tags, the tags must be closed in the order in which they were opened.

Tools of the Trade

Now that we’ve gotten the basic theory out of the way. It’s time to learn how to build our first website.

First off, we must ensure that we have the right tools. Most importantly, we need an HTML editor. There are many choices on the market such as the extremely popular Notepad++.

However, for this tutorial, we will use the Bluefish Editor as it is free and also offers cross platform support for Windows, Mac, and Linux users.

If you don’t want to install any software, but want to preview code instantly — you can use an online HTML editor such as this simple html5 editor.

Do not use Microsoft Word or any other word processor when writing HTML code, only an HTML editor or at the very least, your machine’s built-in notepad, is suitable for the task.

Secondly, ensure that you’ve installed a number of different browsers such as Chrome and Firefox in order to preview your upcoming creation.

Writing your first page with HTML code

First off, you need to open your HTML editor, where you will find a clean white page on which to write your code. From there you need to layout your page with the following tags. These tags should be placed underneath each other at the top of every HTML page that you create.

<!DOCTYPE html>
This tag specifies the language you will write on the page. In this case, the language is HTML 5.

<HTML>
This tag signals that from here on we are going to write in HTML code.

Underneath the HTML we will open two further elements:
<Head>
and
<Body>

The content placed inside the <Head> tag is mostly designed to be read by search engines and other robots and is not for human consumption. This tag identifies your page to other computers and will decide where your content will be ranked in popular search engines including Google.

Inside the <Head> tag we will open two further elements

<Title> This is where we insert the page name as it will appear at the top of the browser window.

Let’s try it out:

Write
<title> My First Webpage </title> on a blank line in your HTML editor.

Next, we will add the metadata, which is the information that search engines read about your site.

This should follow the following format:

<meta charset="UTF-8">

<meta name="description" content="This field contains information about your page. It is usually around two sentences long.">.

We can also create meta name attributes for “keywords”, “author” and other terms that you might want search engine bots to read.

Let’s try it out:
<meta charset="UTF-8">

<meta name="description" content="This is my first website. It includes lots of information about my life.">

Closing tag: </head>

Next, we will make <body> tag.

The HTML<body> is where we add the content which is designed for viewing by human eyes. This includes text, images, tables, forms and everything else that we see on the internet each day.

How to add headings to your page

In HTML, headings are written in the following elements: <h1>, <h2>, <h3>, <h4>, <h5>, <h6>.

As you might have guessed <h1> and <h2> should be used for the most important while the remaining tags should be used for sub headings and less important text. Search engine bots use this order when deciphering which information is most important on a page.

Let’s try it out: On a new line in the HTML editor, type
<h1>Welcome to My Page</h1>
and hit save. We will save this file as “index.html” in a new folder called “my webpage”.

The Moment of Truth: Click the newly saved file and your first ever web page should open in your default browser. It may not be pretty it’s yours….all yours evil laugh

Well let’s now get carried away, we’ve still got loads of great features that we can add your page.

How to add text to your web page

Adding text to our HTML page is simple using an element opened with the tag <p> which creates a new paragraph.

We place all of our regular text inside the element <p>.

When we write text in HTML, we also have a number of other elements we can use to control the text or make it appear in a certain way.

They are as follows:
<b> – Bold text
<strong> – Important text
<i> – Italic text
<em> – Emphasized text
<mark> – Marked text
<small> – Small text
<del> – Deleted text
<ins> – Inserted text
<sub> – Subscript text
<sup> – Superscript text

These tags must be opened and closed around the text in question.

For example:

<p> This is where the text goes. Sometimes we mark it in <strong>bold</strong>. </p>

Let’s try it out: On a new line in the HTML editor, type the following HTML code:
<p> Welcome to <em> my </em> brand new website. This site will be my <strong> new <strong> home on the web. </p>

Don’t forget to hit save and then refresh the page in your browser to see the results.

How to add links to your website

As you may have noticed, the internet is made up of lots of links. Almost everything you click on while surfing the web is a link takes you to another page within the website you are visiting or to an external site.

Links are included in an attribute opened by the <a> tag. This element is the first that we’ve met which uses an attribute and so it looks different to previously mentioned tags.

The <a> (or anchor) opening tag is written in the format:

<a href=“http://www.placeholder.com”>Your Link Text Here </a>

The first part of the attribute points to the page that will open once the link is clicked. Meanwhile, the second part of the attribute contains the text which will be displayed to a visitor in order to entice them to click on that link.

If you are building your own website then you will most likely host all of your pages on a server. In this case, internal links on your website will <a href=“mylinkedpage.html”>Link Title Here </a>.

Let’s try it out: Make a duplicate of the code from your current index.html page. Copy / paste it into a new window in your HTML editor. Save this new page as “page2.html” and ensure that it is saved in the same folder as your index.html page.

On page2 add the following code:

<a href=“http://www.google.com”>Google</a>

This will create a link to Google on page2.

Hit save and return to your index.html page.

On a new line on index.html add the following code:

<a href=“/page2.html”>Page2</a>

Hit save and preview index.html in your browser.

If everything is correct then you will see a link which will take you to your second page. On the second page, there will be a link that will take you to google.com

How to add images to your site

In today’s modern digital world, images are everything. The <img> tag has everything you need to display images on your site. Much like the <a> anchor element, <img> also contains an attribute. The attribute features information for your computer regarding the source, height, width and alt text of the image.

You can also define borders and other styles around the image using the class attribute. However, we shall cover this in a later tutorial.

The file types generally used for image files online are: .jpg, .png and .gif.

Alt text is important to ensure that your site is ranked correctly on search sites and also for visually impaired visitors to your site.

The <img alt> attribute appears as follows:

<img src=“yourimage.jpg" alt= “Describe the image” height="X" width="X">.

Let’s try it out: Save an image (.jpg, .png, .gif format) of your choice in the same folder where you’ve saved index.html and page2.html. Call this image “testpic.jpg”.

On a new line In your HTML editor enter the following code:

<img src=“testpic.jpg alt= “This is a test image” height="42" width="42">

Hit save and preview the index.html page in your browser.

Making a List

How to add lists to your page

In web design, there are 3 different types of lists which you may wish to add to your site.

The first is <ol>: This is an ordered list of contents. Eg.

  1. An item
  2. Another item
  3. Another goes here

Inside the <ol> tag we list each item on the list inside <li> </li> tags.

For example:

<ol>
<li> An item </li>
<li> Another item </li>
<li>Another goes here </li>
</ol>

The second type of list that you may wish to include is a <ul> unordered list. This is better known as a bullet point list and contains no numbers.

An example of this is:

<ul>
<li> This is </li>
<li> An Unordered </li>
<li> List </li>
</ul>

Finally, you may wish to include a definition list <dl> on your page.

An example of a <dl> list is as follows:

Item

The code used for the above is as follows:

<dl>
<dt>Item</dt>
<dd>The definition goes here</dd>
</dl>

Let’s try it out: Open index.html and on a new line, enter the following HTML:

<p> This website will have the following benefits for my business:</p>
<ul>
<li>Increased traffic </li>
<li> Global Reach</li>
<li> Promotional Opportunities</li>
</ul>

Now hit save and check out the results in your browser. If everything worked out then it will display a bullet pointed table displaying the information above.

Adding a table to your website

Another way to keep your website looking neat and orderly is through the use of a table. This is definitely the most complicated part of this tutorial, however, studying it will certainly pay off in the long-run.

Important: Do not use a table to layout your website. Search engines hate it and it is generally a bad idea. Just…don’t.

With this in mind, tables can still be a useful way to present content on your page.

When drawing a table we must open an element with the <table> opening tag. Inside this tag we structure the table using the table rows, <tr>, and cells, <td>.

An example of a HTML table is as follows:

<table>
<tr>
<td>Row 1 - Column 1</td>
<td> Row 1 - Colunm 2 </td>
<td> Row 1 - Column 3 </td>
</tr>
<tr>
<td>Row 2 - Column 1</td>
<td>Row 2 - Column 2</td>
<td>Row 2 - Column 3</td>
</tr>
</table>

This will produce a 2-row table with 3 cells in each row.

Tables can get quite complicated so it is best to leave this for a later tutorial. However, watch out for these tags so that you can recognize them and use them as your skills develop:

<th> – Table header
<colgroup> – Column Group
<thead> – Table head
<tbody> – Table body
<tfoot> – Table foot

Tables, borders, spacing are usually styled using CSS but we will cover this in a later tutorial.

Let’s try it out: Go to a new line on the index.html page within your text editor. Enter the following HTML code:

<table>
<tr>
<td>Row 1 - Column 1</td>
<td> Row 1 - Column 2 </td>
</tr>
<tr>
<td>Row 2 - Column 1</td>
<td>Row 2 - Column 2</td>
</tr>
</table>

Hit save and preview it in your browser.

Congratulations: You did it!

You’ve reached the end of the HTML.com: A Plain and Simple Guide to HTML tutorial.

The final step we need to complete is to close the <body> and <html> tags at the end of each page using the following HTML code:

</body>
</html>

In this guide, you’ve learned how to create basic HTML web pages. You’ve also learned to add headings, text, images, links, lists and basic tables to these pages.

You can now use this knowledge to create your own web pages containing these features and link them together. We suggest that you further enhance your skills by experimenting with the code you’ve learned using different variables. You may also wish to learn about intermediate HTML elements or how to make your pages beautiful using CSS.

The power to create your own website is now in your hands.

Troubleshooting

:In case things didn’t work out as intended, simply check your HTML code against the examples below:

Index.html troubleshooting code
<!DOCTYPE html>
<html>
<head>
<title> My First Webpage </title>
<meta charset="UTF-8">
<meta name="description" content="This is my first website. It includes lots of information about my life.">
</head>
<body>
<h1> Welcome to my webpage </h1>
<p> Welcome to <em> my </em> brand new website. </p>
<p>This site will be my <strong> new <strong> home on the web.</p>
<a href=“/page2.html”>Page2</a>
<img src=“testpic.jpg alt= “This is a test image” height="42" width="42">
<p> This website will have the following benefits for my business:</p>
<ul>
<li>Increased traffic </li>
<li> Global Reach</li>
<li> Promotional Opportunities</li>
</ul>
<table>
<tr>
<td>Row 1 - Column 1</td>
<td> Row 1 - Column 2 </td>
</tr>
<tr>
<td>Row 2 - Column 1</td>
<td>Row 2 - Column 2</td>
</tr>
</table>
</body>
</html>

page2.html troubleshooting code
<!DOCTYPE html>
<html>
<head>
<title> My First Webpage </title>
<meta charset="UTF-8">
<meta name="description" content="This is my first website. It includes lots of information about my life.">
</head>
<body>
<h1> Welcome to my webpage </h1>
<p> Welcome to <em> my </em> brand new website. </p>
<p>This site will be my <strong> new <strong> home on the web.</p>
<a href=“http://www.google.com”>Google</a>
</body></html>

Where to go next?

Thanks for working through this simple crash course to HTML.  Keep learning!

HTML.com’s One Page Cheat Sheet

If you need quick information about particular tag or a specific attribute, check out ourone page cheat sheet. It’s quick, easy, and alphabetized! Bookmark it for future reference.

HTML Tags: Most Used

HTML, which stands for “HyperText Markup Language,” is the coding language for authoring web documents. “Tags” are simply codes that tell a web browser how to display a page. Below are some of the most common tags — used by nearly every website you encounter.

Headings
Headings are a way to make text stand out by breaking up the page.
Paragraph
Paragraphs determine line spacing.
Italics
Create italics text just like in a word processor.
Bold
Bold text emphasizes key words.
Anchor
The anchor tag is most commonly used to create links in combination with the Href attribute.
Unordered List
Unnumbered lists of bullet points use the Unordered List tag.
List Item
Each line on a list is enclosed by a List Item tag.
Blockquote
Blockquote tags are used to enclose quotations from people. This tag helps to differentiate the quote from the text around it.
Horizontal Rule
A horizontal rule is a straight line commonly used for dividing areas of a webpage.
Image
Learn the image tag to find out how to code pictures into your page.
Division
The Division tag defines specific layout styles within CSS.

HTML Tag Attributes: Most Used

What’s the difference between a tagand an attribute? Simply put, attributes are a way to customize HTML tags. While a tag is a command in HTML, attributes describe the specifics of how the tag will be customized.

Alt
The Alt attribute for the Img tag indicates replacement text for images that might not load.
Href
The Href attribute specifies the web address called for by an Anchor (or “a”)tag.
Src
The Src attribute specifies the file location of an image.
Style
Style attributes describe layout information specified by Cascading Style Sheets (CSS).

Popular Tutorials

If you’d like to take a more in-depth tour of a particular web coding skill, visit our tutorials page or jump right into our most popular guides below:

Cascading Style Sheets (CSS) Tutorial
CSS entails special HTML coding that can enhance and streamline the visual coding for your website. For example, you can use CSS to change the font size of every Heading in your document by merely modifying one line in of CSS.
JavaScript Tutorial
JavaScript is arguably the most important web coding language after HTML. Most websites you visit employ at least a little bit of JavaScript coding. If you want to create apps that run in-browsers, you’ll want to dive into this tutorial.
Semantic Markup Tutorial
Our Semantic Markup tutorial explains how your site can benefit from protocols that help search engine crawlers find your site. It also explains how to use HTML tags to talk directly to a visitor’s device so that both humans and search crawlers get the maximum content from your site.
HTML5 Tutorial
Even the Web gets upgrades! HTML5 is the newest version of HyperText Markup Language (HTML), the language that web browsers interpret when they retrieve a web page. In our HTML5 tutorial you can learn how the new coding can help content providers with elements like responsive design and elimination of plugins like Flash. Although previous versions of HTML still work, it’s important to get up to speed on the newest features in website coding.
A Beginner’s Guide to Web Hosting
Whether you’re starting your first blog or you’re a Web veteran wishing to change hosting providers, our guide provides an overview of the lingo as well as comprehensive reviews of individual web hosts.