A double-column design similar to that of Google Plus

Today I attempted to recreate the two-column layout seen in Google Plus post history.

Initially, I tried using column-count, but encountered an issue where the divs were printing one behind the other in the left column before moving to the right column once the first was filled. Although this method correctly filled the space between the divs, it did so in the incorrect order.

Next, I experimented with utilizing bootstrap and pure CSS for responsive grid design, however, I found that there was empty space between divs within the same column (particularly when one div had greater height than its neighbor).

I really need to replicate the system used on Google Plus. Thank you in advance for any suggestions, and have a wonderful day.

.multicols {
    padding:0;
    column-width: 50%;
    column-count: 2;
    -webkit-column-width:50%;
    -webkit-column-count: 2;
    -moz-column-width:50%;
    -moz-column-count: 2;
    -ms-column-width:50%;
    -ms-column-count: 2;
    -o-column-width:50%;
    -o-column-count: 2;

    column-gap: 0;
    -webkit-column-gap: 0;
    -moz-column-gap: 0;
    -ms-column-gap: 0;
    -o-column-gap: 0;
    vertical-align:text-top;
}

.multicols .amulticol {
    display: inline-block;
    margin:0;
    min-height: 100px;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    -moz-column-break-inside: avoid;
    -ms-column-break-before: avoid;
    -o-column-break-before: avoid;
}

To view the code that is causing issues, please visit: jsfiddle.net/PsL8H

Answer №1

It appears you attempted using both bootstrap and pure CSS for this task, however, I suggest incorporating Javascript to achieve the desired result.

You may want to explore Masonry, a "cascading grid layout library," as it could be the solution you are looking for.

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 process for creating a sublist within an md-list-item using Angular Material?

I used Angular Material to create a md-list on the side-nav. I am looking to add a sub list under the md-list-item. Below is my code snippet: <md-sidenav id="sideNav" md-component-id="left" class="md-sidenav-left md-whiteframe-z1 md-locked-open " layo ...

Combining Bootstrap Grids

Is there a way to seamlessly merge two grids as one larger grid without altering the current HTML structure? Currently, it displays as: Child[0] Child[1] Child[2] Child[3] I would like it to display as: Child[0] Child[1] Child[2] Child[3] <div id=& ...

Utilizing Bootstrap 4 columns to control the height of a separate column

Is there a way in CSS to make one column in a bootstrap grid determine the height of another column within the same row? For example, consider the following scenario: <div class="row"> <div class="col col-sm-6" id="column1"> <!-- an e ...

Create a smooth transition: How to make a hidden button appear after a function finishes in JavaScript

I am completely new to the world of JavaScript, HTML, and CSS, so I'm feeling a bit lost on how to proceed with this task. My goal is to create a script that will initially display some text through a specific function. Once that text has been displa ...

GAE does not have access to background images

Having trouble loading background pictures in my GAE front-end app. "Failed to load resource: the server responded with a status of 404 (Not Found)". My app is a simple website, no GAE backend. Using Eclipse with Google AppEngine Plugin. Background pict ...

Gulp fails to generate a CSS file after compiling Sass to CSS

Recently, I've been having trouble compiling my sass file to css. Even though it was working fine before and I haven't made any changes, now my CSS file is empty. Below is the task I am trying to accomplish: gulp.task('sass', function ...

Tips for aligning headers and columns in the same row within an HTML document

Is there a way to keep Table Headers and columns aligned in HTML without wrapping to the next line? Please assist, thank you! ...

Surprising Outcomes of Negative Margin in jQuery Animation

Unique Project Summary I am currently working on a website that incorporates a sliding menu feature. I have successfully implemented this functionality, and the display remains consistent during the animation transitions for sliding the menu in and out. T ...

Adding a fresh, spacious breakpoint in Bootstrap 4 with just CSS

I encountered an issue when the extra large Bootsrap 4 max container width, set at 1140px, was not wide enough for my needs. I aim to ensure that my websites look good on large monitors as well, but the bootstrap grid is too narrow. The most straightforwar ...

Can someone please provide guidance on how to focus on these boxes? (see image below)

My goal is to specifically target the boxes with white dots inside them. Each black box in this picture represents a blog post, even including the larger one at the top. I initially considered using the nth-child selector, but I'm not confident in how ...

Issue with overflow:scroll displaying incomplete div contents

I am attempting to create a sidebar with a fixed position, featuring a small header and a scrollable content area below it. The issue I am facing is that I am unable to scroll through the entire content within the div, resulting in some parts being cut of ...

When the window is resized, Div escapes from view

My issue is that whenever I resize the browser, the div moves out of the window. I am using the jQuery scroll to plugin for navigating through divs. Oddly enough, when I resize the #home div, everything seems to work fine. However, when I resize other divs ...

Ways to eliminate the border color from bootstrap multiselect

I have been attempting to eliminate the border color surrounding options in a select box from Bootstrap Multiselect. Unfortunately, I am unable to identify the specific class responsible for adding the blue color around the option borders. This border app ...

Utilize CSS to vertically align buttons

One of my current projects involves creating a panel with buttons organized in columns side by side, similar to the layout shown below: https://i.sstatic.net/ObAqw.png However, I am struggling to achieve this desired arrangement. Below is the code I hav ...

Replace the pixel measurements with percentage values

I have a vision for creating a dynamic full-width slider using a flex-wrapper and multiple child sections. Each section spans the width of the viewport and is aligned in a row. The goal is to move the flex-wrapper by 100% margin-left every time a button ...

Organize items within a compartment using Bootstrap3

I have decided to update my website to Bootstrap3 and encountered a common issue that many others seem to be facing as well. I am trying to evenly distribute 4 elements, each approximately 220px wide, inside a 990px container. In the old version of Bootstr ...

Enclose every line within a span tag

I'm currently exploring ways to wrap each line of content in a span. For example, suppose I have an element structured like this: .body-copy { position: relative; width: 100%; height: auto } <div class="body-copy"> Lorem ipsum dolor s ...

Issues with the Tumblr platform's back-to-top button functionality

I am quite comfortable with HTML and CSS, but I'm struggling to make the 'back to top' button work on my Tumblr page. Can someone please give me a hand? I've included some JQuery code to make the text fade in and out when scrolling (inf ...

Incorporating a calendar icon within an input field: Step-by-step instructions

Could anyone help me figure out how to insert a Font Awesome icon into the textbox within daterangepicker? Right now, all I see is this: https://i.sstatic.net/7LLmj.png However, I want it to look like this: https://i.sstatic.net/2UyjH.png Here's my ...

The CSS method will not function properly on Safari when targeting the specific ID

that.displayIcon = that.scrollPosition / that.headerHeight $('#icon').css({'opacity':that.displayIcon}) that.rotateIcon = Math.min(1,that.scrollPosition/that.headerHeight) $('#icon').css({'transform':'rot ...