Tags
In HTML, a Tag
is the fundamental unit for structuring and presenting content on a webpage, and it consists of keywords surrounded by angle brackets (< >
).
Tags consist of an opening tag (<tag>
) and a closing tag (</tag>
), with the content that the tag applies to placed in between these two tags.
Below is an example that demonstrates the structure of an HTML tag.
<tag>Content the tag applies to</tag>
An opening tag is represented simply as <tagname>
(for example, <html>
), while a closing tag has a slash (/
) before the tag name, like this </tagname>
(for example, </html>
).
<html>
Hello World!
</html>
Note: Some tags have a slash (
/
) placed after the tag name, known asSelf-closing Tags
. We will learn more about self-closing tags in a later lesson.
Practice
Follow the highlighted sections in the code and try typing them in.