Masonry / Mosaic layout

This is a mosaic / masonry layout I created in Figma for my portfolio site. I want to add images to each of those divs and wrap them in a href which either takes the user to a new page or show a lightbox that will show an enlarged version of the image. The problem is the images not fitting the dimensions of the divs thus not forming the layout. How do I know what dimensions each div is so I can create the images accordingly? The code for the css grid div is:- display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(7, 1fr); grid-column-gap: 0px; grid-row-gap: 0px; .div1 { grid-area: 1 / 1 / 4 / 2; } .div2 { grid-area: 1 / 2 / 2 / 3; } .div3 { grid-area: 2 / 2 / 4 / 3; } .div4 { grid-area: 1 / 3 / 3 / 4; } .div5 { grid-area: 6 / 1 / 8 / 2; } .div6 { grid-area: 4 / 1 / 6 / 3; } .div7 { grid-area: 3 / 3 / 6 / 4; } .div8 { grid-area: 6 / 2 / 8 / 4; }
No description
1 Reply
Chris Bolson
Chris Bolson5mo ago
Giving the images these styles:
width: 100%;
height: 100%;
object-fit:cover;
width: 100%;
height: 100%;
object-fit:cover;
the should adapt to the size of their container without distorting.
Want results from more Discord servers?
Add your server