Screen Printing

TUTORIALS » HTML / JavaScript » HTML essentials (guided tutorials)

Basic HTML tags you can use



In the last tutorial you learned the basic HTML syntax using two basic tags:
<b>
and
<i>
, both of which need to be properly closed.

Before going any further, let's see what other basic HTML tags can do:
Try the following tags (one at a time) using the first_practice.html file you created in the last tutorial, see if you can figure out what each tag does (I'm sure you can):

<h1>HELLO WORLD!</h1>
<h2>HELLO WORLD!</h2>
<h3>HELLO WORLD!</h3>
<h4>HELLO WORLD!</h4>
<h5>HELLO WORLD!</h5>
<h6>HELLO WORLD!</h6>
<big>HELLO WORLD!</big>
<small>HELLO WORLD!</small>
<em>HELLO WORLD!</em>
<strong>HELLO WORLD!</strong>
<u>HELLO WORLD!</u>
<code>HELLO WORLD!</code>
<cite>HELLO WORLD!</cite>
<del>HELLO WORLD!</del>
<sub>HELLO</sub> WORLD!
<sup>HELLO</sup> WORLD!
Note: Although you can use the
<u>
tag to underline a text, I recommend never using it since you can confuse users and make them think it is a link.

Self-closing tags

There are also some self-closing tags, in other words: tags that don't contain any text within. Self-closing tags stand alone, so they don't need to be closed later.

Syntax of a regular open-and-close tag:

<tag>Some text</tag>

Syntax of a self-closing tag:

<tag />

Notice the "/" bar at the end of the tag. This bar tells the browser that the tag is self-closing.
Now try the
<hr />
and
<br />
self-closing tags:
HELLO <hr /> WORLD!
HELLO <br /> WORLD!

Q. What do these tags do?
<br />
inserts a line break (very useful!).
<hr />
inserts a horizontal line.
You just learned a bunch of new tags you can use to format sections of a text, you also learned a couple of useful self-closing tags.

In the next tutorial, we will learn how to write and format whole paragraphs, and force spaces and line breaks.

Comments & Questions