Space allocation among the columns' borders

My layout consists of 3 columns in a row, each with the class col-xs-4, covering the entire row. I am trying to add a border to each column without them overlapping.

Currently, I have applied the border but there is no spacing between the columns. I want to create some distance between the borders so that they appear separated.

Offsetting is not an option as it causes the columns to stack vertically. Is there a way to achieve this?

Answer №1

To create spacing, you can utilize padding along with a nested child div

.col-xs-4 {
  padding: 16px;
}
.col-xs-4 > div {
  border: 1px solid black;
  padding: 16px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
<row>
  <div class="col-xs-4">
    <div>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste necessitatibus, sapiente vitae ullam exercitationem debitis quos quod, consequatur nobis cumque aut totam neque provident tempore recusandae vel quis suscipit eum.
    </div>
  </div>
  <div class="col-xs-4">
    <div>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste necessitatibus, sapiente vitae ullam exercitationem debitis quos quod, consequatur nobis cumque aut totam neque provident tempore recusandae vel quis suscipit eum.
    </div>
  </div>
  <div class="col-xs-4">
    <div>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste necessitatibus, sapiente vitae ullam exercitationem debitis quos quod, consequatur nobis cumque aut totam neque provident tempore recusandae vel quis suscipit eum.
    </div>
  </div>
</row>

Answer №2

To solve the issue, I decreased the size of col-xs-4 and included a border around it.

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

Containers do not line up properly with each other. Adjusting the width leads to unexpected consequences

As someone who is new to HTML and CSS, I am facing a challenge with aligning the items within a navigation bar on my website. The list serves as a navigation bar and is contained inside the "inner header" div. While I was able to align the entire "nav" con ...

Obtaining a string with xpath in Python using BeautifulSoup4

Is there a way to extract a string and place it within an li tag using Python and bs4? I've attempted the following code: from bs4 import BeautifulSoup from lxml import etree html_doc = """ <html> <head> </head> <b ...

What causes the issue when attempting to import multiple CSS files in a Vue.js project using @import more than once?

Currently, I am working on a project that involves one main component and several child components. These components require custom CSS files as well as additional vendor CSS files. A challenge I encountered is that I cannot use the @import "path/to/css/fi ...

Incorporate row numbering feature into jQuery DataTables

Is there a way to have jQuery datatables generate a row number column in the first column, similar to a datagrid in VB? This is what I'm aiming for: If you have any insights on how this can be achieved, please share! ...

Purchase Masonry Supplies for Optimal Arrangement

I've been using a neat little tool called jquery-isotope to create a masonry style layout for the blog posts on my website. It's set up with two columns, showcasing two different post types - long form articles and image-only posts. The masonry ...

Troubleshooting a CSS problem within mat-autocomplete component in Angular 7

While using mat-autocomplete, I noticed that when I select an option from the dropdown and then scroll through the main bar, the dropdown menu does not move along with the autocomplete input field. view image here Here is the code snippet: <td width ...

What is the best technique for creating a preloader that can seamlessly fill the background of a vector image?

I am looking for guidance on creating a CSS3 preloader using a vector image. My goal is to have the logo start off transparent with only the border visible, and as the loading occurs, fill in from bottom to top with the background color. Thank you to ever ...

Deselect a selected radio button by clicking on it

I am trying to create a radio button with an unchecked value, and I thought this code would work: $('form').on('click', 'input[type="radio"]:checked', function (event) { $(this).prop("checked", false); }); It seems simpl ...

Steps to create a thumbnail image following the insertion of an image into an input type="file" within a form, and subsequently submitting both elements on the form together

Currently, I am working on a form that enables users to upload images. Once the user submits the form, my goal is to create thumbnails for each image on the front-end and save them on the server afterwards. Due to security restrictions, changing the value ...

React random marker position shifts when the screen size is adjusted

After displaying an image and adding a marker to it, I noticed that the marker's position changes when the screen size is adjusted. Why does this happen? And more importantly, how can I ensure that the marker stays in the same position relative to the ...

Creating a new project in ASP Net Core Angular using Bootstrap 4 for the SideMenu layout instead of Bootstrap 3

I am currently working on developing a website using Angular6, where I aim to have a vertical navbar for large screens and a top navbar with dropdown functionality for mobile devices. While searching online, I came across several examples that seemed overl ...

Swapping stylesheets using a hyperlink - a simple guide

Currently, I am creating a website that utilizes PHP, XHTML strict, and jQuery. The main goal is to ensure the site is adaptable for mobile and desktop devices by implementing the principles of Responsive Web Design. This involves serving different stylesh ...

What is the sequence in which jQuery events are triggered?

In my HTML code, I have the following: <a href="#" class="topHierarchy big-link" data-reveal-id="myModal" > Both classes, "topHierarchy" and "big-link", are used to attach jQuery event handlers (onClick). big-link triggers a popup box to show, whi ...

Issue with php's mysql_fetch_assoc() function

Seeking to fetch data from a function that holds my query. The retrieved data is sent back to the main page for printing using a while loop but encountering an error: Warning: mysql_fetch_assoc() expects parameter 1 to be resource, string given ...

Below, the HTML contains my response API. I need to retrieve the value 355310 from this in order to set an environment variable in Postman

After receiving the response from the API, I share the picture as shown in the following link: https://i.sstatic.net/irL6Z.jpg ...

What is the best way to incorporate both year and month filters using a dropdown menu on a traditional blog website?

I am currently working on a static blog article website and I am looking to implement a 'filter by year and month' feature. This will allow users to easily sort through blog articles based on their preferences. While I have successfully added a ...

Achieving Navbar overlap on Carousel with Bootstrap

Is there a way to make the bootstrap navbar overlap with the carousel without causing any issues with #test? HTML <nav class="navbar navbar-expand-lg navbar-dark bg-dark floating-navbar"> <div class="container"> & ...

What are the steps to achieve the desired PrimeFaces theme appearance for selectOneMenu?

Need help with a JSF Primefaces project using the omega theme. The selectOneMenu dropdowns are not displaying correctly (missing line). Current look: https://i.stack.imgur.com/vF4ms.png Expected look: https://i.stack.imgur.com/hXsIB.png Any suggestion ...

Dynamic horizontal div elements laid out in a repeating pattern using CSS Grid

I'm fairly new to CSS/Html/JS and I'd like to create a row of Boxes (loaded from a json file) displayed horizontally. Something similar to this: https://i.sstatic.net/ZgxMR.png Here's the code snippet I've been using: <style> ...

The find element will yield an empty result when using XPath contains with Text() method

When checking for Gender and Date in the assertion, it returns false and the IWebElement displays an empty string. This anomaly only occurs with Gender and Date, while the rest provide accurate results. CODE IWebElement actualname = BrowserHelper.WebDri ...