9.4 Homework/Practice
Create a Two-Column Responsive Layout Using Flexbox
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Two-Column Layout</title> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 0; } .flex-container { display: flex; flex-direction: column; gap: 20px; padding: 20px; } .flex-column-1{ flex: 1; padding: 20px; background-color: #f4f4f4; } .flex-column-2{ flex: 1; padding: 20px; background-color: ##d50b0b color:#d1d55b } @media screen and (min-width: 768px) { .flex-container { flex-direction: row; } } </style> </head> <body> <div class="flex-container"> <div class="flex-column-1">Column 1</div> <div class="flex-column-2">Column 2</div> </div> </body> </html>
Last updated