Lesson 2.2: Headings, Paragraphs, Links, Images
π Introduction
HTML provides various tags to structure and organize content on a webpage. Headings, paragraphs, links, and images are the most basic yet essential building blocks. They help in presenting information clearly and making the website interactive.
π Headings in HTML
Headings define the titles or subtitles in a webpage.
-
Tags:
<h1>to<h6> -
<h1>is the largest (main heading),<h6>is the smallest. -
Important for SEO (Search Engine Optimization) and content hierarchy.
β Example:
π Paragraphs in HTML
Paragraphs are written using the <p> tag.
-
They create space before and after the text automatically.
-
Line breaks can be added using
<br>.
β Example:
π Links in HTML
Links are created using the <a> tag (anchor).
-
hrefattribute specifies the URL. -
Can link to external websites, internal pages, or even sections within the same page.
β Example:
π Images in HTML
Images are inserted using the <img> tag.
-
srcattribute specifies the image file path. -
altattribute provides alternative text (important for accessibility and SEO). -
Images do not have a closing tag.
β Example:
π Key Notes
-
Use headings in proper hierarchy (
<h1>β<h6>). -
Paragraphs should be used for readable blocks of text.
-
Always provide
alttext for images. -
Use descriptive text for links (avoid βClick Hereβ).
