Bootstrap 3 is one of the most popular front-end frameworks for creating responsive, mobile-first websites. While tutorials provide theoretical knowledge, exercises help you gain practical experience and reinforce your learning.
At TheCodingCollege.com, we’ve compiled a set of hands-on Bootstrap 3 exercises. These tasks will help you master the framework by applying its components, grid system, and plugins to real-world scenarios.
How These Exercises Will Help You
- Reinforce Concepts: Apply what you’ve learned about Bootstrap 3 in a practical way.
- Build Confidence: Gain experience working with responsive layouts and components.
- Prepare for Projects: Practice creating forms, buttons, and navigation bars that you can use in your own projects.
- Challenge Yourself: Solve exercises of varying difficulty levels to grow your skills.
Bootstrap 3 Exercises
Here are some exercises categorized by difficulty level:
Beginner Exercises
Exercise 1: Create a Responsive Grid Layout
- Create a new HTML file and include the Bootstrap 3 CDN.
- Using the Bootstrap grid system:
- Create a container with three rows.
- Divide the first row into two equal columns.
- Divide the second row into three equal columns.
- Make the third row span the full width of the container.
Hints:
- Use
.container
and.row
classes. - Use
.col-sm-*
for column sizing.
Exercise 2: Add a Navbar
- Add a navigation bar to your project using the Bootstrap 3 navbar component.
- Include:
- A brand logo.
- Links to “Home,” “About,” and “Contact.”
- A dropdown menu under “Services.”
Hints:
- Use the
.navbar
and.navbar-default
classes. - Include the
.dropdown
class for dropdown menus.
Exercise 3: Style Buttons
- Add three buttons to your webpage using Bootstrap classes.
- Style the buttons as:
- A primary button.
- A success button.
- A danger button.
Hints:
- Use
.btn
combined with.btn-primary
,.btn-success
, and.btn-danger
.
Intermediate Exercises
Exercise 4: Build a Responsive Form
- Create a form using Bootstrap 3 components.
- Include:
- An input field for “Name.”
- An email input field.
- A password field.
- A submit button styled as a primary button.
Hints:
- Use
.form-group
for grouping inputs. - Use
.form-control
for input styling.
Exercise 5: Add a Jumbotron
- Add a Jumbotron to your project.
- Include:
- A heading with “Welcome to My Website.”
- A paragraph with a brief description.
- A call-to-action button styled as a success button.
Hints:
- Use the
.jumbotron
class for the container.
Exercise 6: Create an Image Gallery
- Use the Bootstrap grid system to create a responsive image gallery.
- Include:
- Three rows of images.
- Each row should contain three images that adjust their size on smaller screens.
Hints:
- Use
.img-responsive
to make images scale appropriately.
Advanced Exercises
Exercise 7: Implement a Carousel
- Add a Bootstrap 3 carousel to your webpage.
- Include:
- Three slides with images and captions.
- Navigation controls (next/prev buttons).
Hints:
- Use the
.carousel
,.carousel-inner
, and.item
classes.
Exercise 8: Build a Pricing Table
- Create a responsive pricing table using Bootstrap 3.
- Include:
- Three pricing columns (e.g., Basic, Pro, Premium).
- A list of features for each plan.
- A “Sign Up” button styled as a primary button.
Hints:
- Use
.table
for the table structure. - Style the buttons with
.btn-primary
.
Exercise 9: Create a Sticky Footer
- Create a sticky footer that remains at the bottom of the viewport.
- Include:
- A background color.
- Links styled as navigation.
Hints:
- Use the
.navbar-fixed-bottom
class.
Exercise 10: Add a Modal
- Add a modal window to your webpage.
- Include:
- A button to trigger the modal.
- A modal with a title, body content, and a close button.
Hints:
- Use the
.modal
,.modal-header
, and.modal-body
classes.
How to Get the Most Out of These Exercises
- Set Up Your Environment: Use a code editor like VS Code and include the Bootstrap 3 CDN in your HTML file.
- Experiment: Try modifying the provided hints to create unique layouts and designs.
- Review Bootstrap Documentation: Refer to the official Bootstrap 3 documentation if you get stuck.
- Test Responsiveness: Use browser developer tools to see how your designs look on different screen sizes.
Conclusion
Practicing Bootstrap 3 exercises is an excellent way to master the framework and build responsive, mobile-first websites. At TheCodingCollege.com, we’re committed to providing resources that make learning web development fun and engaging.