Using the ID Attribute in HTML
📖 Scenario: You are creating a simple webpage for a local bakery. The page will have a header, a main section with a welcome message, and a footer. To style and link these sections easily later, you need to assign unique IDs to each main part of the page.
🎯 Goal: Build a basic HTML page with a <header>, <main>, and <footer> element. Assign the exact ID attributes page-header, main-content, and page-footer to these elements respectively.
📋 What You'll Learn
Use semantic HTML5 elements:
<header>, <main>, and <footer>.Assign the ID
page-header to the <header> element.Assign the ID
main-content to the <main> element.Assign the ID
page-footer to the <footer> element.Include a
<title> in the <head> with the text 'Bakery Home'.Use proper HTML5 document structure with
lang, charset, and viewport meta tags.💡 Why This Matters
🌍 Real World
Assigning IDs to HTML elements helps web developers target specific parts of a webpage for styling with CSS or interaction with JavaScript.
💼 Career
Understanding and using the ID attribute is fundamental for front-end web development, enabling you to build accessible, maintainable, and interactive websites.
Progress0 / 4 steps