<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flexbox Layout Example</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
background-color: #4CAF50;
color: white;
padding: 15px;
display: flex;
justify-content: space-between;
align-items: center;
}
nav {
display: flex;
gap: 15px;
}
.container {
display: flex;
justify-content: space-around;
margin: 20px;
flex-wrap: wrap;
}
.card {
background-color: #f9f9f9;
border: 1px solid #ccc;
border-radius: 5px;
padding: 20px;
width: 30%;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
text-align: center;
margin: 10px;
}
@media (max-width: 768px) {
.card {
width: 100%; /* Full width on small screens */
}
}
</style>
</head>
<body>
<header>
<h1>Flexbox Layout</h1>
<nav>
<a href="#" style="color: white;">Home</a>
<a href="#" style="color: white;">About</a>
<a href="#" style="color: white;">Services</a>
<a href="#" style="color: white;">Contact</a>
</nav>
</header>
<main>
<div class="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>
</main>
</body>
</html>