<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Simple Grid Layout</title> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 0; } header { background-color: #4CAF50; color: white; padding: 15px; text-align: center; } .grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 20px; } .card { background-color: #f9f9f9; border: 1px solid #ccc; border-radius: 5px; padding: 20px; text-align: center; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); } </style> </head> <body> <header> <h1>Simple Grid Layout</h1> </header> <main> <div class="grid-container"> <div class="card"> <h2>Card 1</h2> <p>This is a simple card.</p> </div> <div class="card"> <h2>Card 2</h2> <p>This is another simple card.</p> </div> <div class="card"> <h2>Card 3</h2> <p>This is yet another simple card.</p> </div> <div class="card"> <h2>Card 4</h2> <p>This is an additional card.</p> </div> </div> </main> </body> </html>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter