Bird
Raised Fist0
Bootsrapmarkup~5 mins

Landing page sections in Bootsrap

Choose your learning style10 modes available
Introduction

A landing page is the first page visitors see. Sections help organize content clearly so visitors understand your message quickly.

When you want to introduce your product or service clearly.
When you want to show features or benefits in separate parts.
When you want to add a call-to-action like a sign-up or buy button.
When you want to share testimonials or customer reviews.
When you want to provide contact information or a footer.
Syntax
Bootsrap
<section class="section-class">
  <!-- Content here -->
</section>

Use semantic <section> tags to group related content.

Bootstrap classes help style and layout these sections easily.

Examples
A hero section with padding and light background.
Bootsrap
<section class="py-5 bg-light">
  <div class="container">
    <h1>Welcome</h1>
    <p>This is the hero section.</p>
  </div>
</section>
A features section using Bootstrap grid to show three columns.
Bootsrap
<section class="py-5">
  <div class="container">
    <h2>Features</h2>
    <div class="row">
      <div class="col-md-4">Feature 1</div>
      <div class="col-md-4">Feature 2</div>
      <div class="col-md-4">Feature 3</div>
    </div>
  </div>
</section>
A call-to-action section with a button and contrasting colors.
Bootsrap
<section class="py-5 bg-primary text-white">
  <div class="container text-center">
    <h2>Call to Action</h2>
    <button class="btn btn-light">Sign Up</button>
  </div>
</section>
Sample Program

This is a simple landing page with a header, features section, call-to-action, and footer using Bootstrap classes for layout and style.

Bootsrap
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Simple Landing Page</title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
  <header class="bg-dark text-white text-center py-5">
    <h1>Welcome to Our Website</h1>
    <p>Your success starts here.</p>
  </header>

  <section class="py-5">
    <div class="container">
      <h2 class="mb-4">Features</h2>
      <div class="row">
        <div class="col-md-4">
          <h3>Easy to Use</h3>
          <p>Our product is simple and intuitive.</p>
        </div>
        <div class="col-md-4">
          <h3>Reliable</h3>
          <p>We ensure 99.9% uptime for your peace of mind.</p>
        </div>
        <div class="col-md-4">
          <h3>Support</h3>
          <p>24/7 customer support ready to help you.</p>
        </div>
      </div>
    </div>
  </section>

  <section class="py-5 bg-primary text-white text-center">
    <div class="container">
      <h2>Get Started Today</h2>
      <p>Join thousands of happy customers.</p>
      <button class="btn btn-light btn-lg mt-3">Sign Up Now</button>
    </div>
  </section>

  <footer class="bg-dark text-white text-center py-3">
    <p>Contact us: info@example.com</p>
  </footer>

  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
OutputSuccess
Important Notes

Use container classes to keep content centered and nicely spaced.

Use padding classes like py-5 to add vertical space in sections.

Choose background and text colors for good contrast and readability.

Summary

Landing page sections organize content clearly for visitors.

Use semantic <section> tags with Bootstrap classes for easy styling.

Common sections include header, features, call-to-action, and 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

  1. 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.
  2. 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.
  3. Final Answer:

    <section> -> Option B
  4. 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

  1. 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.
  2. Step 2: Differentiate from other classes

    container-fluid spans full width always, row and col are for grid layout inside containers.
  3. Final Answer:

    container -> Option D
  4. 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?
<section class="container text-center py-5">
  <h1>Welcome</h1>
  <p>Your journey starts here.</p>
</section>
medium
A. Text aligned right with horizontal padding
B. Left-aligned text with no padding
C. A centered heading and paragraph with vertical padding
D. No visible content due to missing classes

Solution

  1. Step 1: Analyze Bootstrap classes used

    container centers content horizontally with fixed width, text-center centers text, py-5 adds vertical padding top and bottom.
  2. Step 2: Predict visual output

    The heading and paragraph will appear centered horizontally with space above and below them inside a fixed-width container.
  3. Final Answer:

    A centered heading and paragraph with vertical padding -> Option C
  4. Quick Check:

    text-center + py-5 = centered text with vertical padding [OK]
Hint: text-center centers text; py-5 adds vertical padding [OK]
Common Mistakes:
  • Assuming text aligns left by default
  • Confusing py-5 with horizontal padding
  • Thinking container removes padding
4. Identify the error in this landing page section code:
<section class="container text-center py-5">
  <h2>Features</h3>
  <p>Easy to use and responsive.</p>
</section>
medium
A. Mismatched heading tags (<h2> and </h3>)
B. Missing container class
C. Incorrect use of text-center class
D. No closing section tag

Solution

  1. Step 1: Check HTML tag pairs

    The heading starts with <h2> but closes with </h3>, which is invalid HTML and causes rendering errors.
  2. Step 2: Verify other parts

    The container class is present, text-center is correctly used, and the section tag is properly closed.
  3. Final Answer:

    Mismatched heading tags (<h2> and </h3>) -> Option A
  4. Quick Check:

    Matching tags required = mismatched tags error [OK]
Hint: Match opening and closing tags exactly [OK]
Common Mistakes:
  • Closing tags different from opening tags
  • Forgetting to close section
  • Misusing Bootstrap classes
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?
hard
A. <section class="bg-primary text-white text-center py-5"><div class="container"><h2>Join Us</h2><button class="btn btn-light btn-lg">Sign Up</button></div></section>
B. <section class="container bg-primary text-center"><h2>Join Us</h2><button class="btn btn-light">Sign Up</button></section>
C. <section class="text-center py-5"><div class="container bg-primary text-white"><h2>Join Us</h2><button class="btn btn-light btn-lg">Sign Up</button></div></section>
D. <section class="bg-primary text-white py-5"><h2 class="text-center">Join Us</h2><button class="btn btn-light btn-lg">Sign Up</button></section>

Solution

  1. Step 1: Ensure full-width background color

    Applying bg-primary and padding to the <section> ensures the background color spans full width.
  2. Step 2: Center text and contain content

    Using text-center on the section centers text. Wrapping content inside a container keeps it aligned and responsive.
  3. Step 3: Use scalable button

    The button uses btn-lg for larger size and scales well on small screens with Bootstrap's responsive utilities.
  4. Final Answer:

    Option A has all correct structure and classes -> Option A
  5. Quick Check:

    Full-width bg + container + centered text + scalable button = <section class="bg-primary text-white text-center py-5"><div class="container"><h2>Join Us</h2><button class="btn btn-light btn-lg">Sign Up</button></div></section> [OK]
Hint: Put bg on section, content in container, use btn-lg for scaling [OK]
Common Mistakes:
  • Putting bg-primary on container limits width
  • Missing container causes content to stretch too wide
  • Not using btn-lg for button size
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard