HTML Tag Definition

What You Need to Know About HTML Tags

HTML question mark
HTML question mark.

HTML is the language of the Web. The web pages that you view on your computer or phone, including this one, are written in Hypertext Markup Language using what are known as "HTML tags". You can think of HTML as the "under-the-hood code" that controls the structure of a web page.

Ultimately, when you learn any new language, you begin with simple phrases and build from there. Learning about HTML is no different.

You will begin by mastering common HTML tags. This is the equivalent of learning "simple phrases" in a spoken language. Those phrases become the bedrock upon which you build your knowledge and speech, just like HTML tags are the foundation you will build your web development skills upon.

HTML Tag Format

You can recognize an HTML tag because it is surrounded by the characters < and > at the beginning and end of the tag. Between these two characters would be other text that defines what kind of HTML tag is being written. For example, if you know that "hr" means horizontal rule (or line) you would write this for the HTML tag:

<hr>

You've just written an HTML tag that draws a horizontal rule on a web page.

Most HTML tags come in pairs. They are placed at the beginning and at the end of a section of text to dictate the content that they will contain. These tag pair make up HTML elements. When you learn that <strong> and </strong>   are the opening and closing tags to make text bold, you begin to understand how HTML tags affect the appearance of text on a web page.

This sentence will appear in all bold because of the tags. 

Note that the closing strong tag (which stands for "strong emphasis and which, by default, renders text as bold) is identical to the opening bold tag except that it includes a slash in the tag. This is the format that is followed by most HTML tags.

The opening tag and closing tags are the same, with the addition of a slash in the closing that that follows the first < character.

HTML Tag Combinations

HTML tags are frequently used in combination. The opening and closing tags for emphasized (italics) text are <em> and </em> . Adding the italic tags to a single word in the all-bold sentence example causes the word to appear is both bold and italics on the web page.

This sentence will appear in all bold because of the tags. 

Whenever several tags are used together in an element of a web page, with some tags appearing inside of others, they are referred to as nested HTML tags. You must remember that a nested tag, which are the tags inside others, must be closed before their containing tags can be closed.  Look at this example:

<p>This is text that is <em>emphasized</em> for a specific reason.</p>

You should notice that the <em> tag is opened inside the <p>, which means it must be closed before the </p> closing tag appears. Think of nested tags like boxes inside of other boxes. Interior boxes must be closed before their exterior, containing boxes are.

HTML Tags and Web Pages

There are dozens of HTML tags in valid HTML. Some HTML tags dictate very common, basic elements like paragraphs, while others are more complicated and add more functionaliy, like link or "anchor" tags.

A list of HTML tags gives a snapshot of the many functions tags can perform on a web page using tags.

There are also some tags that are required of all webpages. As you build your first page, you will use the <html> tag, which begins a web page; <title> which tells the browser what to display at the top of the browser pane, and <body>, which is where all the web page information goes and is the largest part of your page. 

A list of HTML tags isn't much help until you've gone through an HTML tutorial, but after you do, you can use HTML tags to build your own web page. One note, do not be overwhelmed by the number of possible HTML tags. While there are hundreds of possible tags to use, the reality is that you are likely to only use a handful of them over and over. In fact, there are some HTML tags that I've never used even once in my decades of web design work!

Deprecated Tags

HTML5 is the current markup standard . Some of the tags that were used in earlier versions of HTML are now handled by style sheets in HTML5. The deprecated HTML tags have been removed from the HTML specifications. It is best to not use any obsolete tags.

Original article by Jennifer Krynin. Edited by Jeremy Girard on 5/2/17