How to take blocks out of a grid?

Asked

Viewed 85 times

3

I’m trying to do something similar to the facebook Timeline, two columns with multiple posts, the problem is, in some parts a hole opens, the reason is that the bottom block (on the left) is, in the code, after the above block (on the right).

situação problema

What I want to know is: what to do to get that hole out and put a block together or ignore that position in the code and simply put it together.

HTML

<div class="wrapper">
    <article>
        <h3>Título</h3>
        <h6>Informações</h6>
        <p>Texto</p>
    </article>
    <article>
        <h3>Título</h3>
        <h6>Informações</h6>
        <p>Texto</p>
    </article>
    <article>
        <h3>Título</h3>
        <h6>Informações</h6>
        <p>Texto</p>
    </article>
</div>

CSS

.wrapper {
    width: 100%;
}
.wrapper article {
    float: left;
    width: 49%;
}
  • 1

    Patric have a look here: http://answall.com/q/23646/129

1 answer

4


You can follow the solution below or if you prefer you can use the Masonry

Here is the CSS solution

CSS

.wrapper {
    width: 100%;
    max-width: 700px;
    margin: 2em auto;
    -moz-column-count:2;
    -moz-column-gap: 3%;
    -moz-column-width: 30%;
    -webkit-column-count:2;
    -webkit-column-gap: 3%;
    -webkit-column-width: 30%;
    column-count: 2;
    column-gap: 3%;
    column-width: 30%;
    height: 100%;
}

.wrapper article {
    margin-bottom: 20px;
    background:#e1e1e1;
    display: inline-block;
    width: 100%;
}

The result can be seen in this DEMO

  • There is a problem, when it reaches a certain point of the page it breaks the post in the middle and continues in the second column.

  • @Patrick could publish his code in jsfiddle for me to analyze?

  • It’s the same as the question, the only difference is it doesn’t have the text.

  • Solution http://jsfiddle.net/dieegov/6NJG4/3/ add the following to the article display: inline-block; width: 100%;

  • I’ll use Masonry, it seems more viable.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.