Bootstrap: More Elements & Nesting Grids
Master Bootstrap Components and Advanced Grid Techniques
Bootstrap Fundamentals You'll Master
Form Components
Learn to create professional email signup forms with Bootstrap's form-control and input-group classes. Master button styling and grouping techniques.
Grid Nesting
Understand how to nest columns within other columns using Bootstrap's 12-column system. Create complex layouts with responsive behavior.
Component Styling
Apply Bootstrap classes like img-thumbnail, text-muted, and btn-default to enhance visual presentation and user experience.
For this exercise, we'll be working exclusively with the Bootstrap folder. Open this folder in your code editor if it supports folder-based workflows (like VS Code, Sublime Text, or Atom).
If index.html is not already open in your code editor, open it now. This will serve as our primary working file for implementing email capture functionality and nested layouts.
Quick Setup Process
Clean Up Previous Files
Close any open files and delete the existing Bootstrap folder from your Class Files directory
Rename Starter Folder
Select the Bootstrap Getting Started Done folder and rename it to Bootstrap for consistency
Open in Code Editor
Open the Bootstrap folder in your preferred code editor and locate the index.html file
Bootstrap Button Classes Comparison
| Feature | btn-default | btn-primary |
|---|---|---|
| Visual Style | Subtle gray styling | Bold blue styling |
| Use Case | Secondary actions | Primary call-to-action |
| Visibility | Matches form elements | Stands out prominently |
Form Component Integration Steps
Add Basic Form Structure
Create the form with input and button elements using standard HTML
Apply Bootstrap Classes
Add form-control to input and btn-primary to button for enhanced styling
Group Elements
Use input-group and input-group-btn classes to align elements on the same line
Bootstrap's grid system always uses 12 columns. For three equal columns, use col-sm-4 (3 × 4 = 12). For four equal columns, use col-sm-3 (4 × 3 = 12). This mathematical approach ensures consistent responsive behavior.
Column Distribution Examples
Image Class Options
| Feature | img-responsive | Custom CSS Rule |
|---|---|---|
| Implementation | Class per image | Global CSS rule |
| Maintenance | High repetition | Single rule application |
| Efficiency | Manual class addition | Automatic application |
Creating Custom CSS Integration
Create CSS File
Create main.css in the css folder and add the global image rule
Link After Bootstrap
Link main.css after bootstrap.min.css to ensure proper CSS cascade
Remove Redundant Classes
Remove individual img-responsive classes since the global rule handles responsiveness
Bootstrap Component Classes Applied
img-thumbnail
Adds attractive borders around images, creating a polished gallery appearance for the upcoming shows section.
text-muted
Applies lighter gray styling to descriptive text, creating visual hierarchy without removing important information.
btn-default
Transforms regular links into button-style elements, improving user interface consistency and clickability.
Key Takeaways
