Lesson 2: HTML Elements
Common HTML Elements
HTML uses various elements to structure content. Here are some common elements:
Headings
Headings are defined with the <h1>
to <h6>
tags. <h1>
is the largest, and <h6>
is the smallest.
<h1>This is a Heading 1</h1>
<h2>This is a Heading 2</h2>
<h3>This is a Heading 3</h3>
Paragraphs
Paragraphs are defined with the <p>
tag. They are used to separate blocks of text.
<p>This is a paragraph.</p>
Links
Links are created using the <a>
tag. You can specify the destination using the href
attribute.
<a href="https://www.example.com">Visit Example.com</a>
Images
Images are included using the <img>
tag. The src
attribute specifies the image source, and the alt
attribute provides alternative text.
<img src="image.jpg" alt="Description of Image">
Practice Exercise
Create a simple HTML page that includes headings, a paragraph, a link, and an image. Use the examples provided above to help you.
Next Lesson: HTML Lists