Exploring the possibilities of using grid with Bootstrap 4 card-columns

Appreciation for the abundance of information on stackoverflow pertaining to card-columns, I managed to configure tiled cols in a row. However, it seems like there is some sort of padding or margin causing an issue with Bootstrap's 12 columns per row "rule".

My goal is to achieve a masonry / pinterest tile layout where Tile 1 and Tile 2 columns are positioned below the description column while keeping the white text beneath the profile picture.

In the example below, setting the width of the description col to col-xl-4 causes it to be positioned under the profile picture col instead of next to it.

Furthermore, the description column ends up being the same height as the profile picture column.

   <div class="container-fluid">
        <div class="row card-columns">
            <div class="col-xl-8 card">
                <div class="card-body">
                    <h2>Profile picture</h2>
                    <img src="https://via.placeholder.com/900x500.jpg" alt="" class="img-fluid rounded">
                </div>
            </div>

            <div class="col-xl-4 card">
                <div class="card-body">
                    <h2>Description</h2>
                </div>
            </div>  

            <div class="col-xl-8 card">
                <div class="card-body">
                    <h2>Text</h2>
                </div>
            </div>  

            <div class="col-xl-2 card">
                <div class="card-body">
                    <h2>Tile 1</h2>
                </div>
            </div>  

            <div class="col-xl-2 card">
                <div class="card-body">
                    <h2>Tile 2</h2>
                </div>
            </div>  
        </div>
    </div>

How do I resolve this issue? What could be the missing piece here?

Answer №1

Tested this out on a different platform https://jsfiddle.net/pba8h4dk/.

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<div class="container-fluid">
  <div class="row">
    <div class="col-lg-9 card">
      <div class="card-body">
        <h2>User image</h2>
        <img src="https://via.placeholder.com/900x500.jpg" alt="" class="img-fluid rounded">
      </div>
    </div>

    <div class="col-lg-3 card">
      <div class="card-body">
        <h2>About me</h2>
      </div>
    </div>  
  </div>
</div>

By removing the card-columns class, it solved the issue (and of course ensuring your screen size is correct).

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

What is the best way to ensure text starts on a new line when paragraphs and images are floating and aligned?

Does anyone have a clearer title idea? Feel free to edit. To better illustrate my point, I've created a jsfiddle. I am working with a simple layout of text and images. My goal is to make the second text and image appear on a new row just below the f ...

Using CSS to create a zoom effect with absolute positioning

I am attempting to implement an interesting effect on my website where clicking a thumbnail causes a full-size div to "zoom in" from the thumbnail. My initial strategy involved using CSS and jQuery, setting the full-size div to position:absolute with top a ...

Element positioning in Material UI is fluid and responsive across all devices, with the ability to place elements at

As a novice in layout design, I am currently developing a web application for both mobile and desktop using React and Material UI. My challenge lies in placing the app navigation at the bottom of the screen. The issue arises because the location of the app ...

Tips on accessing the left value of a absolutely positioned object that transitions on click using getComputedStyle or a similar method

Question: How can I ensure that when the target is clicked, the correct and updated value of the left property is returned? For example, I want it to return 120px if --moved is applied, and 100px if it is not applied. Background: Utilizing getComputedStyl ...

CSS for a Div with a Subtle Curve at the Bottom

Is there a way to achieve this specific shape using CSS? I attempted to use the following resources, but they didn't provide me with the desired outcome. Curved border with stroke in pure CSS? http://jsfiddle.net/ECHWb/ .banner-img{ height: 661p ...

Are there any methods to adjust the spacing of bootstrap card grids and optimize the maximum limit?

Having a bit of an issue with my bootstrap cards in a Flask for loop. It's working fine, but every time I pass 3 cards, a new column starts and messes up the layout. Check out this screenshot for an example: https://ibb.co/jTvtSbq Also, the vertical ...

Having trouble with the functionality of Bootstrap's nav-tabs 'show' feature?

I'm having some issues with adding a search box to my glossary. The glossary is created using nested unordered lists (ul) within another ul that has classes of "nav-tabs" and "bootstrap". In the JavaScript code, I am using the following snippet: $j(& ...

When using CKEditor, pressing the Enter key results in the insertion of <br /> tags

Whenever I use ckeditor, I find that pressing enter results in two <br /> tags being inserted. While I want to keep the line break tags, having them appear twice is not ideal. In my config.js file, I have set the configuration for the enter key as f ...

Unexpected malfunction in CSS Grid within Flexbox layout

After extensive testing, I have found that the .articleWrapper for post child items scales correctly when used on its own. However, as soon as I place this .articleWrapper inside another wrapper-element with display: flex, it loses its ability to scale hor ...

Is it possible to mask the variant box lines on my product pages by utilizing the Shopify Lite Buy Button?

I am trying to integrate a vertical, full-width button into my Squarespace product page. My goal is to only display the images and hide all other elements such as the product title, price, and description by setting their display property to "none". Howev ...

Stop bootstrap from pushing image onto new line within the navigation bar

I need the navbar to show the donation bar on the same line as the navigation options. When resizing the image, it drops down as shown below. I have attempted using responsive img tags and divs with column sizes, but they have not been successful. As an a ...

Creating a customized style for a child styled-component within a parent component

In my attempt to style a nested <Input /> component using styled-components, I find myself facing a challenge. The nested input is being utilized within a different component that displays a dropdown when typing. My goal is to apply padding-left: 3re ...

Guide to Presenting HTML data stored in an SQL database on an ASP.NET webform

I need help figuring out how to dynamically display a blog page from my database. The content I'm pulling contains HTML tags, so right now it's showing the raw data with tags included. What I really want is for it to display like a proper page. ...

CSS Overflow-y problem on Internet Explorer

Having some trouble with IE 11 when it comes to the overflow-y on my website. When you click on the Chicken with Leeks and Mushrooms recipe in Chrome, the recipe details scroll nicely within the div. However, in IE it's not working as expected. If ...

Unable to get table borders to display correctly using CSS styling

Can someone lend me a hand with a CSS issue I'm facing? I want to create some CSS "classes" for tables in my form, but I can only get the borders to display correctly on one of the tables. Here is the code I've been using: table.paddedTable tabl ...

unique design for custom scrollbar on dropdown menu

I'm looking to customize the scrollbar for a select box. I've experimented with the code below, but I want to avoid using the default scrollbar on the select box. Instead, I want to implement a custom scrollbar without using the size attribute on ...

Enhanced HTML table using Bootstrap with a plethora of additional elements

I know this might sound like a silly question, but I've been struggling to create an HTML table that has the following requirements: https://i.sstatic.net/FiRSD.jpg Additionally, I want the table to be hover sensitive so that when you place your curs ...

Achieving Varied Line Heights in a CSS Flexible Grid Column Layout - Vertical Text Alignment Tips for Top Placement

Currently, I am designing a web layout that requires a flexible column structure with varying line heights. The main objective is to have one column with a higher line-height while ensuring that both paragraph texts in different columns start from the same ...

svg rect mistakenly appearing as a rounded polygon

I found a cool SVG pie chart on this codepen that I want to modify. The original chart is 50 x 50 and animated, but I want to make it 20 x 20. To resize the pie chart, I tried changing the width, height, radius, and center points in the code. I also adjus ...

caption sliding into the incorrect div box

As I continue my journey of learning CSS, I've encountered a puzzling issue involving slide-in captions within a different div element. The problem arises when I try to customize the appearance of the caption to better fit the overall design of my web ...