Building a Simple Webpage with Block-level Elements
📖 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 with contact information. You will use block-level elements to structure the page.
🎯 Goal: Build a basic HTML page using block-level elements: , , and . Each section will contain text content relevant to the bakery.
📋 What You'll Learn
Use semantic block-level elements: , , and
Include a heading inside the header.
Add a paragraph inside the main section.
Place contact information inside the footer.
Ensure the HTML structure is valid and well-formed.
💡 Why This Matters
🌍 Real World
Block-level elements help organize webpage content clearly and semantically, making it easier for browsers and assistive technologies to understand the page structure.
💼 Career
Knowing how to use semantic block-level elements is essential for web developers to build accessible and maintainable websites.
Progress0 / 4 steps
1
Create the HTML skeleton with <html> and <body>
Write the basic HTML structure starting with <!DOCTYPE html>, then add the <html lang="en"> tag, and inside it add the <body> tag.
HTML
Hint
Start with the document type declaration and add the root html element with language attribute, then add the body element inside html.
2
Add a <header> with a heading inside <body>
Inside the <body> tag, add a <header> element. Inside the header, add an <h1> heading with the text "Welcome to Sweet Treats Bakery".
HTML
Hint
Use the tag to group the heading, and place an
inside it with the exact text.
3
Add a <main> section with a welcome paragraph
Below the <header>, add a <main> element. Inside , add a <p> paragraph with the text "We bake fresh bread and delicious pastries every day."
HTML
Hint
Use the tag for the main content and add a paragraph inside it with the exact text.
4
Add a <footer> with contact information
Below the <main> section, add a <footer> element. Inside the footer, add a <p> paragraph with the text "Contact us at contact@sweettreats.com".
HTML
Hint
Use the
Practice
(1/5)
1. Which of the following is a block-level element in HTML?
easy
A. <img>
B. <span>
C. <div>
D. <a>
Solution
Step 1: Understand block-level elements
Block-level elements start on a new line and take full width.
Step 2: Identify the element type
<div> is a block-level element, while <span>, <img>, and <a> are inline elements.
Final Answer:
<div> -> Option C
Quick Check:
Block-level element = <div> [OK]
Hint: Block elements start new lines and fill width [OK]
Common Mistakes:
Confusing <span> as block-level
Thinking <img> is block-level
Assuming <a> creates a block
2. Which HTML tag correctly represents a block-level element?
easy
A. <header>
B. <img>
C. <button>
D. <label>
Solution
Step 1: Recall block-level tags
Tags like <header> are block-level and create sections.
Step 2: Check other tags
<img>, <button>, and <label> are inline or replaced elements, not block-level.
Final Answer:
<header> -> Option A
Quick Check:
Block-level tag = <header> [OK]
Hint: Headers and sections are block-level [OK]
Common Mistakes:
Choosing <img> as block-level
Confusing <button> with block
Thinking <label> is block-level
3. What will be the visual layout of this HTML snippet?