Bootstrap Structure and Containers
Exploring Bootstrap Structure and Containers
Welcome back! In the previous lesson, you set up Bootstrap in your projects. This foundational step is essential as it allows you to unlock Bootstrap's rich features. Now that you have Bootstrap ready, let's explore its structure, containers, and spacing, which are crucial for designing responsive layouts.
What You'll Learn
In this lesson, we're diving into the basics of Bootstrap's structure, containers and spacing. By the end of this lesson, you’ll be able to:
-
Understand Bootstrap's Basic Structure:
- Learn about the standard elements that form the foundation of a Bootstrap project.
- Recognize the importance of Bootstrap’s grid system and how containers play a role.
-
Use Bootstrap Containers:
- Identify the differences between Default (Fixed), Fluid, and Responsive containers.
- Apply these containers in your HTML to create responsive web layouts.
-
Utilize Bootstrap Spacing:
- Understand Bootstrap's utility classes for margins and padding.
- Apply spacing utilities to ensure consistent spacing across your layout.
What Are Containers?
Containers are one of the most basic layout elements in Bootstrap. They are essential for proper spacing and alignment when using Bootstrap's default grid system. Every layout in Bootstrap begins with a container, ensuring that your content is neatly organized and displayed consistently across various devices.
Bootstrap features three different containers:
-
Default (Fixed) Container:
- This type of container has a fixed width that changes at different breakpoints to adapt to the viewport size. It provides a responsive, centered layout:
-
Fluid Container:
- This container spans the entire width of the viewport, offering a full-width layout regardless of the screen size:
-
Responsive Containers:
- This specialized type of container adjusts itself based on the viewport size and can be customized further using Bootstrap's utility classes.
- Usage of responsive containers is similar to the default container. For example, you can use
container-sm,container-md,container-lg, etc., to apply the container properties at specific breakpoints. Here's an example:
