Understanding Tags, Elements, and Attributes
HTML is composed of ‘tags’ that format and organize the content on a web page. Each tag usually comes in pairs: an opening tag (<tag>
) and a closing tag (</tag>
). An ‘element’ is everything from the start tag to the end tag. An ‘attribute’ provides additional information about an element, usually in the form of attribute="value"
.
Commonly Used Tags
- Paragraph Tag (
<p>
):- Used to define paragraphs.
<p>This is a paragraph.</p>
- Heading Tags (
<h1>
to<h6>
):- Used for headings,
<h1>
being the largest and<h6>
the smallest.
- Used for headings,
<h1>This is a heading</h1>
<h2>This is a sub-heading</h2>
- Break Tag (
<br>
):- Used to insert a line break.
This is a line.<br>This is a new line.
- Horizontal Rule (
<hr>
):- Used to insert a thematic break in the page (a horizontal line).
<p>Paragraph 1</p>
<hr>
<p>Paragraph 2</p>
Conclusion
Understanding these basic HTML tags is essential for structuring the content of web pages. They allow you to create clear and organized documents. As you become more familiar with these tags, you’ll find it easier to build more complex structures and layouts.