ADVERTISEMENT
Google AdSense Slot (headerLeaderboard)

Set your Publisher ID in src/config/ads.ts to display live ads.

HTML5 Tutorial• 5 min read

HTML Basic Examples

Headings, paragraphs, links, and images in action

In this chapter we will show some basic HTML examples: headings, paragraphs, hyperlinks, and images.

HTML Headings

HTML headings are defined with the <h1> to <h6> tags.

<h1> defines the most important heading. <h6> defines the least important heading.

Search engines use headings to index the structure and content of your web pages, making them critical for SEO.

HTML Headings Example
<h1>Heading 1 - Main Title</h1>
<h2>Heading 2 - Major Section</h2>
<h3>Heading 3 - Subsection</h3>
<h4>Heading 4 - Minor Heading</h4>
<h5>Heading 5 - Sub-minor</h5>
<h6>Heading 6 - Smallest Heading</h6>

HTML Links and Images

HTML links are defined with the <a> (anchor) tag. The link destination is specified in the href attribute.

HTML images are defined with the <img> tag. The source file name is provided in the src attribute, and alternative text in alt.

Links and Images Example
<p>Check out our tutorials:</p>
<a href="https://example.com" target="_blank">Click here to explore</a>

<h3>Our Mascot:</h3>
<img src="https://images.unsplash.com/photo-1517694712202-14dd9538aa97?w=400" alt="Laptop on desk" width="300" height="200" style="border-radius: 8px;">
Pro Tip

Always provide the "alt" attribute on images. It is vital for screen readers (accessibility) and displays fallback text if the image fails to load.

ADVERTISEMENT
Google AdSense Slot (inContentBanner)

Set your Publisher ID in src/config/ads.ts to display live ads.

Test Yourself With Exercise

+15 XP

Which attribute specifies the destination URL for a hyperlink in an <a> tag?