I’m trying to recreate a navigation component from my design mockup but I can’t get the positioning right. I’ve been working on this travel website layout and need help with arranging the filter boxes properly.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="main.css">
<title>Travel Site</title>
</head>
<body>
<div class="wrapper">
<header class="topbar">
<div class="container">
<img src="logo.png" alt="Logo">
<nav class="main-nav">
<a href="#" class="current">Home</a>
<a href="#">Destinations</a>
<a href="#">About</a>
<a href="#">Contact</a>
</nav>
<div class="auth-buttons">
<button class="login-btn">Sign In</button>
<button class="signup-btn">Register</button>
</div>
</div>
</header>
<main class="hero-section">
<div class="container">
<div class="hero-content">
<h1>Find Your Dream Vacation</h1>
<p>Discover amazing places around the world</p>
<div class="search-panel">
<div class="filter-box location-filter">
<span>Location</span>
</div>
<div class="filter-box activity-filter">
<span>Activity</span>
</div>
<div class="filter-box rating-filter">
<span>Rating</span>
</div>
<div class="filter-box date-filter">
<span>Date</span>
</div>
</div>
</div>
<div class="hero-image">
<img src="travel-image.jpg" alt="Travel">
</div>
</div>
</main>
</div>
</body>
</html>
.search-panel {
display: flex;
flex-wrap: wrap;
gap: 15px;
margin-top: 30px;
max-width: 500px;
}
.filter-box {
flex: 1;
min-width: 200px;
height: 60px;
border: 1px solid #ccc;
border-radius: 8px;
display: flex;
align-items: center;
padding: 0 20px;
background: white;
}
The search-panel div contains my filter elements. I’ve tried both flexbox and grid but can’t get them to align like in my design. The boxes should be arranged in a 2x2 grid pattern but they keep stacking weird. Any suggestions on what I’m missing here?