0

I'm trying to figure out a way on how I can convert a specific part of my layout into a masonry layout just using flexbox. Basically the layout changes by specific breakpoint when resize(specifically 768px). I know I can achieved this just using margin-top with a negative value to offset the fourth element but is there a proper way to do this using media-queries

enter image description here

/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
   margin: 0;
   padding: 0;
   border: 0;
   font-size: 100%;
   font: inherit;
   vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */

article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
   display: block;
}

body {
   line-height: 1;
}

ol, ul {
   list-style: none;
}

blockquote, q {
   quotes: none;
}

blockquote:before, blockquote:after, q:before, q:after {
   content: '';
   content: none;
}

table {
   border-collapse: collapse;
   border-spacing: 0;
}

* {
   -webkit-box-sizing: border-box;
   -moz-box-sizing: border-box;
   box-sizing: border-box;
}

footer {
   background-color: beige;
}

footer .wrap {
   padding: 20px 0;
   display: flex;
   flex-wrap: wrap;
   max-width: 1280px;
   margin: 0 auto;
}

footer .wrap .menu, footer .wrap .contact-details {
   flex: 25%;
}

footer .wrap .contact-details strong {
   display: block;
}
<footer>
  <div class="wrap">
    <ul class="menu">
        <li>Menu 1</li>
        <li>Menu 2</li>
        <li>Menu 3</li>
        <li>Menu 4</li>
    </ul>

    <ul class="menu">
        <li>Menu 1</li>
        <li>Menu 2</li>
        <li>Menu 3</li>
        <li>Menu 4</li>
    </ul>

    <ul class="menu">
        <li>Menu 1</li>
        <li>Menu 2</li>
        <li>Menu 3</li>
        <li>Menu 4</li>
    </ul>


    <div class="contact-details">
        <strong>Contact</strong>
        <p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.</p>
    </div>


  </div>
</footer>
clestcruz
  • 1,081
  • 3
  • 31
  • 75
  • 1
    possible duplicate: https://stackoverflow.com/q/44377343/3597276 – Michael Benjamin Nov 01 '17 at 11:47
  • 1
    No, Flexbox can't do that, Grid can (as Michael show in his link). Here is another possible duplicate, a nice solution based on javascript (no jQuery): https://stackoverflow.com/questions/13518653/layout-theory-for-a-thumbnail-gallery/13521470#13521470 – Asons Nov 01 '17 at 18:19

0 Answers0