I am trying to create a flexbox row with full width and multiple columns in one container.
I tried flex-break: after; but not sure what I am missing. I am trying to avoid multiple classes such as .fullwidth and .multiple-columns .
This is what I am trying to achieve:
------------------------ | | | | | item A | | | | | ------------------------ | | | | | | | B | C | | | | | | | ------------------------ | | | | | item D | | | | | ------------------------
.collage { position: relative; display: flex; justify-content: flex-start; align-items: center; } .fullwidth { flex-break: after; } .collage-item { width: 100%; height: 25vw; background: url("https://www.audi.co.uk/content/dam/audi/production/Models/NewModelsgallery/A5range/A5_Coupe/MY17/1920x1080_A5-Coupe-2016-side.jpg") no-repeat; background-size: cover; } .btn { position: absolute; border: 2px solid white; padding: 10px 18px; text-align: center; right: 8px; bottom: 8px; color: white; text-decoration: none; }
<div class="collage"> <div class="collage-item fullwidth"></div> <div class="collage-item"></div> <div class="collage-item"></div> <div class="collage-item fullwidth"></div> <div class="btn">Button</div> </div>
https://jsfiddle.net/brunodd/ja6820vu/1/
source share