HTML Basics

coding-924920_960_720

Learn HTML

Are you feeling a bit lost when someone mentions those four letters, “HTML”? Well it is actually very easy to learn and understand. We will cover how to set up a simple page, how to format text, insert images, and insert links. Lets start by explaining what it is exactly.

When you visit a page, you see columns, images, links and different colors. This has all been written by someone (or someone used a program to write it). And it is written in HTML. All web pages are sent to your browser (such as “Internet Explorer” or “Firefox”) as HTML.

HTML is the easiest “computer language” to learn. Now, when you write a formal letter to someone, there are things you add at the start and end aren’t there (such as at the start their address, the date, and at the end your name and signature). Between these items you write the body of the letter. Well, in some ways, the basics of HTML is very similar.

Let me just give you an example of a simple page. This would display the words “Welcome” in the browser (the numbers in bold are not part of the code – they are just line numbers so we know what we are talking about later on).

1]     <html>
2]        <head>
3]            <title>Site Title</title>
4]        </head>
5]
6]        <body>
7]            Welcome
8]        </body>
9]    </html>

All tags start and end. A start tag looks like <xxx> and and ending tag for it would look like </xxx>. There are many tags – <u>…</u> for underline, <b>…</b> for bold etc.

If we go back to the letter example, you normally write your address, the date, their address etc at the top. Well this is what the first four lines are like. The first line, <html> (note, in html, it doesn’t normally matter if it is upper or lower case. In some technologies such as xhtml it does, but for now it doesn’t matter) just declares that between that html “tag” as it is known, and the ending html tag on line 9 (notice the back slash, indicating it has ended) it has html within it.

The head contains information that isn’t directly displayed by your browser. The <title> tag contains the title of the page, which is shown at the top of your browser. Other things such as keywords go into your head tag, but thats a bit more advanced.

You should put all your content within the <body> tag that you want the user to see inside the main part of their browser.

To do links
A link is something that lets you click on it, and it will request a new page. You use the anchor tag for this:

<a href=”http://www.example.com”>CLICK HERE </a>

Do you see how that would work? It would display the words “CLICK HERE”, and that links to http://www.techneek.co.uk. This tag, the <a … >  tag has an example of an attribute to it – the href.

Almost all attributes have a =” “. It is basically like saying, I have an anchor tag. I want to make it link to something. To tell it to link to something, you need to put href=”yourlink”. Remember when ending this tag (</a>), you don’t need to put in the href. It is always just </a>.

Bold, Italic, Underline

These are really simple – you probably already know them. <b> bold text </b> for bold, <u> underline </u> or <i> italic </i>

<b>Spaces in HTML</b>
Spaces to some extent don't matter. I could write this line:
<a href=”http://www.example.com”>example.com</a>
as:
<a href=”http://www.example.com”>
example link
</a>

In HTML, any multiplies of a space – ‘ ‘ just show up as one. To display more than one you need to type &nbsp;.

Images

Images are really simple. It is just <img src=”yourimagelink”>. You don’t even need an ending tag (no </img> tag!). If you want to specify the height/width, use height=”120” width=”400”;
<img src=”yourimagelink.jpg” height=”99” width=”89”>

Incase the image can’t be loaded for yoru user, you should give an alternative text. This is also good for people who find it hard to see on the screen. To do this, add alt=”a description of your image”. I would personally recommend no more than 6 words.

<img src=”youimagelink.jpg” width=”200” height=”100” alt=”View of a beach”>

It is recommended that the only image types you use are Gifs (.gif), Jpegs (.jpg), or Portable Network Graphic (.png). Try and keep the file sizes down, some users are on very slow speeds.

So there you are, you should be able to make a page now. Open up notepad, paste this template in:

<html>
<head>
<title>Your first webpage</title>
</head>

<body>

Your content goes here, such as <a href=””http://www.example.com”>Example</a>!

</body>
</html>

And replace the “…” bits with your content. Save it as a .htm or .html file (it makes no difference what you choose) and open it in your browser.

Here is an example simple web page using everything we have covered so far:


<html>
<head>
<title>Hello!!</title>
</head>

<body>
<b><i>Hello!</i>Welcome to <u>my</u> page! Click on the image to go to http://www.example.com</b>

<a href=””http://www.example.com”>

<img src=”exampleimage.jpg” alt=”Example image” height=”400” width=”400”>

</a>
</body>
</html>

Now you are ready to go further. I recommend that you search for things on your favorite search engine, such as:

paragraph HTML tag
hr HTML tag
Center HTML tag
basic CSS tutorial
uploading webpage OR website tutorial server

Have fun!

About

I am a Web UI/UX Designer who specializes in user interface design, user experiences and programming languages like HTML, CSS, and Front-End Frameworks like Bootstrap. I enjoy working on and blogging about projects that involve a mix of web user interface (UI) design, user experience (UX) research, mobile design prototyping, eCommerce, content creation and internet marketing.