Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • BS5 Tutorial
  • BS5 Interview Questions
  • BS5 Layout
  • BS5 Content
  • BS5 Components
  • BS5 Helpers
  • BS5 Utilities
  • BS4 Tutorial
  • BS Tutorial
  • Bootstrap Cheatsheet
  • Tailwind
  • CSS Frameworks
  • HTML Formatter
Open In App
Next Article:
How to remove gutter space for a specific div in Bootstrap ?
Next article icon

How to remove gutter space for a specific div in Bootstrap ?

Last Updated : 21 Jun, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

In Bootstrap 4, the grid system comprises 12 columns with small spaces in between, known as gutter space. Each column has a gutter space of 30px, split into 15px on each side. Managing this gutter space is important for achieving the desired layout and spacing in your web design. This article will explain what gutter space is and how to remove it for specific div elements using Bootstrap 4.

Understanding Gutter Space in Bootstrap 4

Gutter space refers to the spacing between columns in the Bootstrap grid system. It ensures proper alignment and spacing of column content. By default, each column has a 15px padding on both sides, totaling 30px between two columns.

Approach to Removing Gutter Space

  • By default, Bootstrap 4 has class="no-gutters" to remove gutter spaces of any specific div. The following image shows the highlighted gutter space and space between columns on bootstrap 4 12 column grid system. You can even modify gutter width by reducing 15px width of gutter space between each columns.

Example 1:

Below example illustrate how to remove gutter space for a specific div.

html
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="utf-8">     <meta name="viewport" content="width=device-width, initial-scale=1">     <link rel="stylesheet" href= "https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">     <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">     </script>     <script src= "https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">     </script>     <script src= "https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">     </script> </head>  <body>     <center>         <div class="container">             <h1 style="color:green;padding:13px;">               GeeksforGeeeks             </h1>             <br>             <div class="row p-3">                 <h2><em>With Gutter space</em></h2>             </div>             <div class="row border border-dark ">                 <div class="col-12 col-sm-6 col-md-8 bg-primary ">                     .col-12 .col-sm-6 .col-md-8                 </div>                 <div class="col-6 col-md-4 bg-secondary">                     .col-6 .col-md-4                 </div>             </div>              <div class="row p-3">                 <h2><em>Without Gutter space</em></h2>             </div>             <div class="row no-gutters border border-dark">                 <div class="col-12 col-sm-6 col-md-8 bg-primary ">                     .col-12 .col-sm-6 .col-md-8                 </div>                 <div class="col-6 col-md-4 bg-secondary">                     .col-6 .col-md-4                 </div>             </div>         </div>     </center> </body>  </html> 

Output:

Example 2:

Below example illustrate how to remove gutter space for a specific div only.

html
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="utf-8">     <meta name="viewport"            content="width=device-width, initial-scale=1">     <link rel="stylesheet" href= "https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">     <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">     </script>     <script src= "https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js">     </script>     <script src= "https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">     </script> </head>  <body>     <center>         <div class="container">             <h1 style="color:green;padding:13px;">               GeeksforGeeeks             </h1>             <br>              <div class="container">                              <div class= "row no-gutters">                     <div class= "col-6 col-sm-3 bg-info">                         .col-6 .col-sm-3                     </div>                     <div class= "col-6 col-sm-3 bg-danger">                         .col-6 .col-sm-3                     </div>                     <b><em>Without Gutter space</em></b>                 </div>                                  <div class="row ">                     <div class= "col-6 col-sm-3 bg-warning">                         .col-6 .col-sm-3                      </div>                     <div class= "col-6 col-sm-3 bg-success">                         .col-6 .col-sm-3                      </div>                     <b><em>With Gutter space</em></b>                 </div>                                  <div class= "row no-gutters">                     <div class= "col-4 col-sm-2 bg-success">                         .col-4 .col-sm-2                      </div>                     <div class= "col-4 col-sm-2 bg-danger ">                         .col-4 .col-sm-2                      </div>                     <div class= "col-4 col-sm-2 bg-info">                         .col-4 .col-sm-2                     </div>                     <b><em>Without Gutter space</em></b>                 </div>                                  <div class= "row ">                     <div class= "col-4 col-sm-2 bg-danger">                         .col-4 .col-sm-2                      </div>                     <div class= "col-4 col-sm-2 bg-info">                         .col-4 .col-sm-2                      </div>                     <div class= "col-4 col-sm-2 bg-warning">                         .col-4 .col-sm-2                     </div>                     <b><em>With Gutter space</em></b>                 </div>             </div>         </div>     </center> </body>  </html> 

Output:

Removing gutter space in Bootstrap 4 is essential for creating precise and custom layouts. By using the no-gutters class or adjusting the padding for specific columns, you can control the spacing between your grid elements effectively. This flexibility allows for cleaner and more tailored designs, enhancing the overall appearance and functionality of your web pages.

For more detailed information, you can refer to the official Bootstrap documentation.


Next Article
How to remove gutter space for a specific div in Bootstrap ?

V

VigneshKannan3
Improve
Article Tags :
  • Web Technologies
  • Bootstrap
  • Bootstrap-4

Similar Reads

    How to set one column control over height in Bootstrap ?
    Creating an HTML document using Bootstrap and make more than one column. The task is to set the control to a column over the height using Bootstrap. The way to do this is by utilizing another div interior in the left column. The inward div ought to be position: absolute. Example: HTML <!DOCTYPE h
    2 min read
    How to Set full height in box-inner div using bootstrap 4 ?
    The d-flex is an inbuilt class in Bootstrap 4 which can be used to set the full height to a div. We will illustrate it with the working code example below. Syntax: <div class="d-flex"> ... <div> Below code create three divs in a horizontal arrangement but the problem is the height of inn
    2 min read
    How to Specify Divider gap in Square Grid using Bootstrap ?
    The CSS grid-row-gap property is used to set the size of the gap between the grid row elements. Similarly, the CSS grid-column-gap property is used to set the size of the gap (gutter) between the column elements.  Syntax: CSS grid-column-gap propertygrid-column-gap: none|length|percentage|initial|in
    2 min read
    How to fix Spacing Classes in Bootstrap?
    Bootstrap 5 provides a comprehensive set of spacing utilities that can be used to control the spacing between elements. These utilities cover various spacing properties, including margin and padding that can be applied to different sides of an element (top, right, bottom, left, and all sides). Below
    3 min read
    How to move a container inside of another container in Bootstrap 5 ?
    The container is used to set the content’s margin. It contains row elements and the row elements are containers of columns. This is known as the grid system. In this article, we will learn about How to move a container inside of another container in Bootstrap 5. We will move a container to the left
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences