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.
Activity Instructions
Try making the text in the playground strong.
- Look at the preview screen to see what the text looks like without any tags
- In the HTML window, write <strong> before the first word
- Write </strong> after the last word
- Look at the preview screen to see what the browser will display