📖 Scenario: You are building a simple landing page for a new app. The page will have a header, a main section with a welcome message, and a footer. You will use Bootstrap to style the page and make it look neat on all devices.
🎯 Goal: Create a landing page with three sections: a header with a navigation bar, a main section with a welcome message inside a container, and a footer with copyright text. Use Bootstrap classes to style and arrange these sections responsively.
📋 What You'll Learn
Use Bootstrap 5 CSS from CDN
Create a <header> with a Bootstrap navbar containing the brand name 'MyApp'
Create a <main> section with a Bootstrap container and a centered welcome message inside an <h1>
Make sure the page is responsive and uses semantic HTML5 elements
💡 Why This Matters
🌍 Real World
Landing pages are the first impression for many websites and apps. Knowing how to build them with Bootstrap helps create professional, responsive designs quickly.
💼 Career
Web developers often use Bootstrap to speed up layout and styling tasks. Understanding how to structure landing page sections is a common job requirement.
Progress0 / 4 steps
1
Create the basic HTML structure with Bootstrap link
Write the basic HTML5 skeleton with lang="en", meta charset="UTF-8", and viewport meta tag. Include the Bootstrap 5 CSS CDN link inside the <head>. Add empty <header>, <main>, and <footer> elements inside the <body>.
Bootsrap
Hint
Remember to include the Bootstrap CSS link inside the <head> section.
2
Add a Bootstrap navbar inside the header
Inside the <header>, add a Bootstrap navbar with the class navbar and bg-light. Include a container inside the navbar. Add a brand link with class navbar-brand and text 'MyApp'.
Bootsrap
Hint
Use a <nav> element with classes navbar bg-light and place the brand link inside a div with class container.
3
Add a welcome message inside the main section
Inside the <main>, add a Bootstrap container. Inside it, add an <h1> with the text 'Welcome to MyApp!' and center the text using Bootstrap classes.
Bootsrap
Hint
Use a div with classes container text-center mt-5 to center the heading and add some top margin.
Use Bootstrap classes bg-dark, text-white, text-center, and py-3 on a div inside the footer.
Practice
(1/5)
1. Which HTML tag is best to use for defining distinct sections in a Bootstrap landing page?
easy
A. <div>
B. <section>
C. <span>
D. <article>
Solution
Step 1: Understand semantic sectioning tags
The <section> tag is designed to group related content into distinct parts of a page, making it ideal for landing page sections.
Step 2: Compare with other tags
While
is a generic container, it lacks semantic meaning. <span> is inline and not for sections. <article> is for self-contained content, not general sections.
Final Answer:
<section> -> Option B
Quick Check:
Semantic sections = <section> [OK]
Hint: Use <section> for clear, semantic page parts [OK]
Common Mistakes:
Using <div> without semantic meaning
Confusing <article> with <section>
Using inline tags like <span> for layout
2. Which Bootstrap class would you use to create a responsive container for a landing page section?
easy
A. container-fluid
B. col
C. row
D. container
Solution
Step 1: Understand Bootstrap container classes
The container class creates a responsive fixed-width container that adapts to screen sizes, perfect for landing page sections.
Step 2: Differentiate from other classes
container-fluid spans full width always, row and col are for grid layout inside containers.
Final Answer:
container -> Option D
Quick Check:
Responsive fixed container = container [OK]
Hint: Use 'container' for fixed responsive width [OK]
Common Mistakes:
Using container-fluid when fixed width is needed
Confusing row or col as containers
Not wrapping content in a container
3. What will be the visual result of this Bootstrap landing page section code?
5. You want a landing page call-to-action section with a full-width background color, centered text, and a button that scales on small screens. Which Bootstrap structure is best?