What is a Tag?

Just think of them as boxes

What are Tags

Tags are used to describe content to the web browser. Tags are words or acronyms surrounded by < >. Tags usually come in pairs, an opening and a closing tag. The tag must be opened and closed to display correctly in the browser.

Opening tags look like this: <strong>
Closing tags look like this: </strong>

The only difference is that closing tags have an extra forward slash /.

Here is a full example: <strong> This text is "strong" (or is of strong importance) </strong>

Visible?

Tags are not displayed in the web browser. The main purpose of tags is to tell the web browser how content, between the opening and closing tags, should be classified. If you write this:

<strong> This text is "strong" </strong>

The browser will display the following:

This text is "strong"

The strong tags told the web browser that all the text in-between the opening and closing tag should be classified as bold.

Self Closing tags

There are a few tags that do not have separate opening and closing tags. These tags are called self closing tags. Here is a short list of these exceptions:

• <br /> This is the line break tag
• <hr /> This is the horizontal rule tag
• <img /> This is the image tag
• <link /> This is the link tag

Activity

Here you can test out what you read, and achieve badges.

This text is surrounded by opening and closing strong tags


Try making the text in the playground strong.

  1. Look at the preview screen to see what the text looks like without any tags
  2. In the HTML window, write <strong> before the first word
  3. Write </strong> after the last word
  4. Look at the preview screen to see what the browser will display

HTML

CSS

JavaScript

Output