HTML Exercises
A complete set of exercises covering all HTML topics from basics to advanced techniques.
1. 📑 HTML Fundamentals
Exercise: Create a Basic HTML Page
Create a basic HTML structure with a title in the head section and a simple heading and paragraph in the body.
Explanation: This is the simplest HTML structure. It includes the <head> for metadata and the <body> for the content.
2. 📝 HTML Basic Elements
Exercise: Use Basic HTML Elements
Create a page that includes:
- An unordered list (
<ul>) with 3 items. - An ordered list (
<ol>) with 3 items.
Explanation: Use <ul> for an unordered list and <ol> for an ordered list. The list items are enclosed in <li> tags.
3. ✨ HTML Text Formatting
Exercise: Format Text Using HTML Tags
Create a paragraph with both bold and italicized text.
Explanation: The <strong> tag makes text bold, and the <em> tag italicizes the text.
4. 📋 HTML Lists
Exercise: Create a Nested List
Create a list with nested items.
Explanation: Nested lists are made by placing another <ul> inside an <li>.
5. 🔗 HTML Links
Exercise: Create Hyperlinks
Create two links: one external and one internal.
Explanation: <a> tags are used for creating links. The href attribute specifies the URL or anchor.
6. 🖼️ HTML Images
Exercise: Embed an Image
Insert an image with an alt description.
Explanation: The <img> tag is used to display images. The alt attribute provides a textual description of the image for accessibility.
7. 📊 HTML Tables
Exercise: Create a Table
Build a table with a header and two data rows.
Explanation: <th> is used for table headers, and <td> is used for table data cells.
8. 📝 HTML Forms
Exercise: Create a Simple Form
Create a form that includes:
- A text input for a name.
- Radio buttons for gender.
- A submit button.
Explanation: Forms are used to collect user data. The <input> tag is used to gather input, and <button> is used to submit the form.
9. 🎥 HTML Multimedia
Exercise: Embed a Video
Embed a video element with controls.
Explanation: The <video> tag allows you to embed video content. The controls attribute adds playback controls.
10. 🏷️ HTML Semantic Elements
Exercise: Use Semantic HTML Elements
Create a page with header, main content, and footer sections.
Explanation: Semantic elements like <header>, <main>, and <footer> provide meaning and improve SEO.
11. ⚙️ HTML Block vs Inline
Exercise: Block and Inline Elements
Use block and inline elements.
Explanation: Block-level elements, like <div>, take up the full width, whereas inline elements, like <span>, take up only as much width as the content.
12. ✨ HTML Entities
Exercise: Display Special Characters
Use HTML entities to display special characters.
Explanation: HTML entities allow you to display special characters like <, >, and &.
13. 🛠️ HTML Attributes
Exercise: Use Various Attributes
Add attributes to elements like href, alt, and id.
Explanation: Attributes like href specify link destinations, and alt provides descriptions for images.
14. 🔧 HTML Meta Tags
Exercise: Add Meta Tags
Add meta tags for charset, description, and author.
Explanation: Meta tags provide additional metadata to the page, like the character encoding and description.
15. 🛋️ HTML Layout
Exercise: Create a Flexbox Layout
Use Flexbox to create a layout with two columns.
Explanation: Flexbox is a CSS layout system that allows you to create flexible and responsive layouts.
16. 🌍 HTML APIs (HTML5)
Exercise: Use Geolocation API
Create a button that displays the user’s current location.
Explanation: The Geolocation API allows you to get the user’s geographical position.
17. 🧑🦯 HTML Accessibility
Exercise: Use ARIA for Accessibility
Add ARIA roles for better accessibility.
Explanation: ARIA attributes improve the accessibility of web pages for users with disabilities.
18. 🏆 HTML Best Practices
Exercise: Follow Best Practices
Ensure that your HTML follows these best practices:
- Proper indentation.
- Using semantic tags.
- Adding
altattributes for images. - Adding labels for form elements.
19. 🖌️ HTML Advanced Topics
Exercise: Implement an HTML5 Canvas
Draw a rectangle on an HTML canvas.
Explanation: The <canvas> tag allows you to draw graphics on a web page using JavaScript.