HTML Tags

What is an HTML tag?

Tags are the elements of code that mark up text in an HTML file to be interpreted by the web browser into a web page. Examples include <p> for paragraphs, <h1> for headings, and <img> for images.

How do HTML tags work?

Tags should always be closed, denoted by a forward slash. At the end of a paragraph, for example, the closing tag in the HTML should be </p>. Some tags, such as images and line breaks, are often self-closing like so <br />. Failing to close a tag is considered poor style and can cause formatting issues.

Tags can contain attributes that contain more information about the text within them, such as the “alt” attribute for images and the “class” attribute that assists in CSS styling.

Back to Glossary