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?

<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

The central navigation system of the Owl Carousel

I am currently using the owl carousel plugin and I am struggling to figure out how to center align the navigation vertically while also using the autoHeight option. http://codepen.io/anon/pen/jJAHL I have attempted the following code snippet, but it seem ...

Personalize the way UIkit tooltips appear

I've been working on customizing a uikit tooltip for my checkbox. I managed to change the font and background color, but for some reason, I can't adjust the font size. I even tried adding a custom class without success. Do you think it's pos ...

Managing various swipe interactions using HTML and JavaScript/jQuery

I'm in the process of creating a mobile multiplayer game using HTML5 and Javascript. The jQuery Plugin "touchwipe" is utilized to manage swipe events in various divs like this: $('#play1').touchwipe({ wipeLeft: function(){ if ...

What is the best approach to managing categorical variables with Flask?

After developing a machine learning model to classify a target variable Y based on predictors x1, x2, x3, and others, I needed to create an HTML form "calculator" for users. The form requires the user to input data for x1, x2, x3, etc., and then displays t ...

Tips for aligning placeholder and text at the center in a React Material UI TextField

Existing Layout: https://i.stack.imgur.com/Zv4Tg.png Desired Layout: https://i.stack.imgur.com/Xuj6O.png The TextField element is displayed as follows: <TextField multiline={false} autoFocus placeholder={props.defaultAmt} ...

Arrange divs in a stack fashion

Currently, I have a table-styled three-column set of divs. I would like these columns to stack vertically on mobile devices. I think this can be achieved using the float method, but the titles and descriptions for each column are in separate rows (divs), ...

Adding static files to your HTML page with node.js

This is not a question about using express.static() In my application, I have multiple pages that share the same JS and CSS dependencies. Instead of adding <script> or <link> tags to every single page, I'm looking for a way to include the ...

What is the best way to calculate the width for each of the three elements in a row so that they all have 300px

Creating my own framework using flexbox has been an interesting journey. One of the major challenges I faced with flexbox is when dealing with an odd number of elements in a row, such as 3, 5, or 7. To tackle this issue, I decided to use JavaScript/jQuery. ...

"Enhance user experience with jQuery's text expansion and collapse

Figuring out how to collapse and expand text with a button click has been challenging for me. I managed to make the text collapse when the button is clicked, but now I also need it to expand back again. The goal is to have the text initially hidden, then e ...

Transform an iOS WebView into a user-friendly ebook reader

Typically, in a webview, you can scroll vertically like a browser if the page is too long. However, I am interested in transforming this experience to mimic an ebook reader. Rather than scrolling down, I would like users to be able to swipe to the next pag ...

Extract Hyperlink from a Specific Class using Python's Selenium

Currently, I am faced with the challenge of extracting the href from the HTML snippet below. However, my method requires the identification of the second data class in order to retrieve the href: <tr> <td class="data"> <a targe ...

Could you please review my PHP code? I encountered a syntax error: unexpected '}' character. Thank you

I encountered an issue in the final line <?php } ?> as it reports a syntax error, unexpected '}' <?php if (isset($_SESSION['u_id'])) { //echo "You are logged in!"; include_once 'database.php&apo ...

Preserve proportions while resizing the browser window

I needed my code to ensure that the images keep their aspect ratio regardless of the screen size or if the user resizes their browser instead of viewing it full screen. I have some code in place, but I'm unsure how to maintain the current effects of ...

Just a snippet of a webpage shown

My website focuses on online magazines. I'm looking for a way to selectively display specific parts of articles that are in regular HTML format with a global CSS stylesheet applied. There are no images, only text. How can I extract certain segments of ...

Adjust the background color of the arrow in an HTML Select element

My select menu looks different in Firefox compared to Chrome/Edge In Firefox, it displays an "arrow button" https://i.stack.imgur.com/BGFvO.png However, in Chrome/Edge, the arrow button is not present https://i.stack.imgur.com/PXNJn.png Is there a way ...

Unable to access placeholder information from the controller

I am new to implementing the mean stack. I attempted to view data from the controller, but encountered an error message in the web browser's console. Error: [$controller:ctrlreg] http://errors.angularjs.org/1.6.3/$controller/ctrlreg?p0=AppCtrl Stack ...

What is the best way to change a date from the format DD/MM/YYYY to YYYY-MM-DD

Is there a way to use regular expressions (regex) to convert a date string from DD/MM/YYYY format to YYYY-MM-DD format? ...

Tips on setting the ajax parameter contentType to "html"

I'm encountering an issue where the variable "myvariable" is passing as null. Can anyone provide guidance on what I might be doing incorrectly? $.ajax({ type: "POST", url: "/MyController/MyAction", data: JSON.stringify({ items: my ...

Is it possible to have 3 divs with the height of the tallest

I have a unique template that I employ for crafting responsive websites. It relies on boxes with percentage widths, floats, and clears. A prime instance can be viewed via this link. Notice how the three boxes vary in height. While it's simple to set a ...

Establish a vertical column that matches the height of its parent element

Is there a way to create a column that matches the height of its parent element? I have a navbar followed by a container with three columns. The challenge is to make the last right column the same height as its parent and also scrollable. In this scenario, ...