Tags
In HTML, tags
are the basic building blocks used to structure and present content on a web page.
Tags are composed of keywords enclosed in angle brackets (< >
), like <tag>
.
A tag consists of an opening tag (<tag>
) and a closing tag (</tag>
), with content that the tag applies to placed between these two tags.
Below is an example of the structure of an HTML tag.
<tag>Content that the tag applies to</tag>
The opening tag is denoted by <tagname>
(e.g., <html>
) with only angle brackets, while the closing tag is denoted by </tagname>
(e.g., </html>
) with a slash (/
) before the tag name.
<html>
Hello World!
</html>
Note: Some tags can also have a slash (
/
) at the end of the tag name, and these are calledself-closing tags
. We will learn more about self-closing tags in a later lesson.
Practice
Follow the emphasized parts of the code and try to write it out yourself.