Programming Exercises

Build a responsive masonry layout for images using only CSS.

Hard

Problem Statement

Build a responsive masonry layout for images using only CSS.

Sample Output

Images are displayed in a masonry-style grid.

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
<!DOCTYPE html> <html> <head> <style> /* Add CSS here to create the masonry layout */ </style> </head> <body> <div class="masonry"> <img src="img1.jpg" alt="Image 1" /> <img src="img2.jpg" alt="Image 2" /> <img src="img3.jpg" alt="Image 3" /> <img src="img4.jpg" alt="Image 4" /> </div> </body> </html>
Log in or sign up to run or submit your code.Log inSign up
Expected Output
Images are displayed in a masonry-style grid.