T02: HTML Tags
HTML tags are like labels on boxes. Each tag tells the browser what kind of content is inside. A heading tag says "this is a title," a paragraph tag says "this is a block of text." The browser uses these labels to display content appropriately.
Headings and Text
HTML provides six levels of headings, from <h1> (most important) to <h6> (least). Paragraphs use the <p> tag.
<h1>Main Title</h1>
<h2>Section Title</h2>
<h3>Subsection</h3>
<p>A paragraph of text goes here.</p>
Links and Images
The anchor tag <a> creates clickable links. The image tag <img> embeds pictures. Note that img is a self-closing tag.
<a href="https://example.com">Visit Example</a>
<img src="photo.jpg" alt="A description">
Lists
Unordered lists use <ul> with <li> items (bullet points). Ordered lists use <ol> (numbered items).
<ul>
<li>First item</li>
<li>Second item</li>
</ul>
graph TD
A[html] --> B[head]
A --> C[body]
B --> D[title]
C --> E[h1]
C --> F[p]
C --> G[ul]
G --> H[li]
G --> I[li]
C --> J[a]
C --> K[img]
Key Takeaways
- Headings h1-h6 create a content hierarchy - use them in order
- Links use the a tag with an href attribute for the destination URL
- Images use the img tag with src and alt attributes
- Lists come in two flavors: ul for bullets, ol for numbers