Increase the gap between columns in Bootstrap for a better layout

I have implemented a web layout using bootstrap 3. You can view the JSFiddle here. In order to make the layout responsive, I had to structure it in a slightly unconventional way. The final output on small screens includes three information boxes within an 80% width container, each taking up 4 columns. This structure was necessary for responsive functionality. Now, my question is how can I increase the white-space padding between these boxes?

https://i.sstatic.net/dJ7bK.png

<div class="container PageViews">
  <div class="row Page2 text-center">
    <div class="col-sm-4 padded">
      <div class="glyphicon-ring"> <span class="glyphicon glyphicon-bullhorn glyphicon-bordered"></span> </div>
    </div>
    <div class="col-sm-4">
      <div class="glyphicon-ring"> <span class="glyphicon glyphicon-ok glyphicon-bordered"></span> </div>
    </div>
    <div class="col-sm-4">
      <div class="glyphicon-ring"> <span class="glyphicon glyphicon-phone glyphicon-bordered"></span> </div>
    </div>
    <div class="col-sm-4">
      <div class="box">
        <div class="row">
          <div class="col-xs-6 col-sm-12">
            <h3>Title 1</h3>
          </div>
          <div class="col-xs-6 col-sm-12 eqheight1">
            <p class>Text 1 </p>
          </div>
        </div>
      </div>
    </div>
    <div class="col-sm-4">
      <div class="box">
        <div class="row">
          <div class="col-xs-6 col-sm-12">
            <h3>Title 2</h3>
          </div>
          <div class="col-xs-6 col-sm-12 eqheight2">
            <p>Text 2</p>
          </div>
        </div>
      </div>
    </div>
    <div class="col-sm-4">
      <div class="box">
        <div class="row">
          <div class="col-xs-6 col-sm-12">
            <h3>Title 3</h3>
          </div>
          <div class="col-xs-6 col-sm-12 eqheight3">
            <p>Text 3</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

CSS:

.Page2 > *:nth-child(-n+3) {
  border-bottom: 0;
  padding-top: 10px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

.Page2 > *:nth-last-child(-n+3) {
  border-top: 0;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  padding-bottom: 2em;
}

.Page2 > * {
  border: 5px solid white;
  background: #3DBEAF;
}

Answer №1

Bootstrap utilizes a 12-column grid system for organizing content on a webpage. If you desire more space between elements, consider reducing the number of columns being used. Switching from col-sm-4 to col-sm-3 can achieve this.

To create additional spacing between boxes, adjust the margin rather than the padding.

I made modifications to your jsfiddle code and specifically altered this section to increase the gaps between the boxes:

.Page2 > *:nth-child(-n+3) {
  border-bottom: 0;
  padding-top: 10px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

.Page2 > *:nth-last-child(-n+3) {
  border-top: 0;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  padding-bottom: 2em;
}

.Page2 > * {
  border: 5px solid white;
  background: #3DBEAF;
}

.col-sm-3 {
 margin-right: 8%;
}

Title 1

Text 1

Title 2

Text 2

Title 3

Text 3

Expand to full page view to observe the changes.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Adjusting label widths in Fieldcontain with JQuery Mobile

I've done a lot of research online, and it seems like a common issue. In the past, I have tackled this problem using a <table>, but I am now looking to resolve it using CSS instead of relying on JQM's data-grid. The simple problem I am fac ...

Create a visually appealing DataGrid cell by incorporating a vibrant colored oval with text or an icon inside

I'm in need of assistance with the mui/x-data-grid plugin. My goal is to display a cell within the grid containing both text and an icon, based on the value of the text. Unfortunately, I have been unable to achieve this so far. Here is the link to the ...

The image fails to display correctly

As I work on creating a basic webpage in HTML and JavaScript, my goal is to validate certain parameters (such as width, height) of an image that users upload via a form. In JavaScript, I extract the file from the form and attempt to display it as an image ...

Mixing elements from the entire webpage

My goal is to create a cohesive look for the entire page by applying a background gradient to all layers. #myDIV { width: 400px; height: 400px; background-image: linear-gradient(-45deg, rgba(251, 234, 188, 1) 0%, rgba(0, 114, 136, 1) 100%); } .bl ...

utilizing different types of text style

Whenever I write a paragraph, I want the text to be styled like this: Click here for alt text http://img6.imageshack.us/img6/9894/fullscreencapture282010.jpg Do I need to use CSS to achieve this kind of formatting? I'd like it to look similar. ...

jquery's animation causing elements to move abruptly when containing text

For the past hour, I've been grappling with jQuery and could really use some assistance. The following example showcases smooth animations: when you click on either of the divs, the selected div will move left or right if the viewport is wider than 70 ...

experiencing a problem with the scrollTo() function

I am encountering difficulty in finding the correct X and Y coordinate values to move an image using mouse scroll within a div. I have included my sample code below. I have successfully managed to scroll the image without using a div. Can anyone assist m ...

Unable to Send Messages through HTML Email Form

I have recently obtained a Bootstrap website template and I am facing an issue with the functionality of the form that is supposed to send messages to my email. Despite filling in all the required fields, the message confirms submission but no actual email ...

Creating two divs with equal heights in React using Material-UI at 50% each

I am currently utilizing a Material UI template within a react JS project. My goal is to create a div (or Grid in MUI) that spans 100% of its container's height, containing two nested divs (or Grids) that are each set at 50% height. If the internal c ...

Adjusting the columns of two tables when one table is held in place

My dilemma involves managing two tables: In the scenario, Table 1 remains fixed in place serving as a header that is always visible. Meanwhile, Table 2 acts as the data table. I am not a fan of fixed widths for my tables; I prefer them to dynamically adj ...

Issue with using float-right in Bootstrap v4. [Alternative to pull-right]

I am currently using the most recent version of Bootstrap, which is v4.0.0-beta.3. I am having trouble getting elements to align properly according to the official documentation. Despite searching online for solutions, I have not been able to find any that ...

The HTML element seems to be missing its height parameter

My element doesn't have a set height, but it's populated with images causing the Anchor around the images to be unclickable unless I assign a fixed height to .portfolio. Any ideas on how to resolve this? HTML Snippet : <h1 class="text-c ...

How can we display a different navbar based on whether the user is logged in or not?

Can anyone share the most effective methods for displaying a different navbar based on whether or not a user is logged in? I have considered a few approaches: One option might involve creating two separate navbars in the HTML file and using CSS to tog ...

Target the first element within a tree structure using CSS

Trying to target the initial blockquote in an email body with varying formats, such as: <div class="myclass"> <br><p></p> <div><div> <!--sometimes with less or more div--> <blockquote&g ...

The parent container is not properly wrapping its content in Internet Explorer only

Check out this code snippet I have here: https://jsfiddle.net/kimwild/mtxgtwr5/2/ main#wrapper { z-index: 1; width: 100%; position: relative; overflow: hidden; background-color: red !important; border: 10px dotted #4D37DB; } figure#about-im ...

What consequences could occur in HTML if the main tag is not properly enclosed within the body tag?

Just starting out. While working with HTML, I experimented with placing the main tag outside of the body tag instead of nesting it inside as recommended by HTML5 standards. To my eye, both versions looked identical when I viewed the HTML file side by sid ...

"Occasional issue with Bootstrap Multiselect not persisting selections when page is reloaded via

When I load a page using ajax that contains a form with a bootstrap multiselect, the multiselect stops working after reloading the page in ajax to apply changes. It doesn't expand when clicked (without any JavaScript errors). However, if I submit the ...

What is causing the table to not be displayed in this Javascript program when it is used in a

I am currently experimenting with incorporating an infinite loop before the prodNum and quantity prompts to consistently accept user input and display the output in a table. Although the program is functional when executed, it fails to showcase the table ...

There seems to be a problem retrieving the JSON file

My JavaScript file is designed to fetch a JSON file and execute a function if successful. If there's an error, it should display an alert window with the message "error". However, despite checking the syntax, I keep receiving an error alert every time ...

Problem arising from implementing background and relative positioning in html and css

Encountering an issue with html and css. Today, attempted to create a page with a large background image for the first time. Utilizing the foundation framework, but facing a challenge. Foundation is an adaptive framework, and when resizing the browser, a ...