Programming Exercises

Create a responsive grid layout where items rearrange based on screen size using only CSS.

Hard

Problem Statement

Create a responsive grid layout where items rearrange based on screen size using only CSS.

Sample Output

The items rearrange into a grid layout of two columns on larger screens and one column on smaller screens.

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
<!DOCTYPE html> <html> <head> <style> /* Add CSS here to create the responsive grid layout */ </style> </head> <body> <div class="grid"> <div class="item">1</div> <div class="item">2</div> <div class="item">3</div> <div class="item">4</div> <div class="item">5</div> <div class="item">6</div> </div> </body> </html>
Log in or sign up to run or submit your code.Log inSign up
Expected Output
The items rearrange into a grid layout of two columns on larger screens and one column on smaller screens.