HTML elements are the building blocks of web pages. Each element has a specific purpose.
| Element | Purpose | Example |
|---|---|---|
<h1>...<h6> | Headings (6 levels) | <h1>Title</h1> |
<p> | Paragraph | <p>Text content</p> |
<a> | Link | <a href="url">Link text</a> |
<img> | Image | <img src="pic.jpg" alt="description"> |
<ul> | Unordered list | <ul><li>Item</li></ul> |
<ol> | Ordered list | <ol><li>Step 1</li></ol> |
<div> | Container | <div>Group content</div> |
<span> | Inline text | <span>highlighted</span> |
Attributes provide additional information about elements:
href — URL for linkssrc — URL for imagesalt — Alternative text for imagesclass — CSS class nameid — Unique identifier<div>
<h2>John Doe</h2>
<p>Software developer from San Francisco</p>
<img src="photo.jpg" alt="John's photo">
<a href="https://twitter.com">Follow on Twitter</a>
</div>Build an HTML page with a list of your favorite things:
1. A heading "My Favorites"
2. An unordered list with at least 3 items
3. Each item should be a link to a website related to that favorite
HTML elements are the building blocks of web pages. Each element has a specific purpose.
| Element | Purpose | Example |
|---|---|---|
<h1>...<h6> | Headings (6 levels) | <h1>Title</h1> |
<p> | Paragraph | <p>Text content</p> |
<a> | Link | <a href="url">Link text</a> |
<img> | Image | <img src="pic.jpg" alt="description"> |
<ul> | Unordered list | <ul><li>Item</li></ul> |
<ol> | Ordered list | <ol><li>Step 1</li></ol> |
<div> | Container | <div>Group content</div> |
<span> | Inline text | <span>highlighted</span> |
Attributes provide additional information about elements:
href — URL for linkssrc — URL for imagesalt — Alternative text for imagesclass — CSS class nameid — Unique identifier<div>
<h2>John Doe</h2>
<p>Software developer from San Francisco</p>
<img src="photo.jpg" alt="John's photo">
<a href="https://twitter.com">Follow on Twitter</a>
</div>Build an HTML page with a list of your favorite things:
1. A heading "My Favorites"
2. An unordered list with at least 3 items
3. Each item should be a link to a website related to that favorite