Create a responsive layout with only 5 cards in a row. I attempted this, but it's not working. What should I add? I want the number of items in a row to adjust according to the size and always hold a maximum of 5 elements in a row.
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Tours</title>
<link rel="stylesheet" href="3destination_style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="container">
<div class="card">
<div class="img">
<img src="image-url">
</div>
<div class="top-text">
<div class="name">
PlaceName
</div>
<p>
Area Description
</p>
</div>
<div class="bottom-text">
<div class="text">
Description Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorem quaerat iusto adipisci reprehenderit quasi cum perspiciatis, minima reiciendis magni quam!
</div>
<div class="btn">
<a href="#">Read more</a>
</div>
</div>
</div>
...More card elements here...
</div>
</body>
</html>
@import url('https://fonts.googleapis.com/css?family=Poppins:400,500,600,700&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
html,body{
height: 100%;
display: grid;
place-items: center;
background: #1d222b;
text-align: center;
}
.container{
padding: 0 40px;
display: flex;
align-items: center;
justify-content: space-between;
}
.card{
height: 280px;
max-width: 350px;
margin: 0 20px;
background: white;
transition: 0.4s;
box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
}
.card:hover{
height: 470px;
box-shadow: 5px 5px 10px rgba(0,0,0,0.2);
}
.card .img{
height: 200px;
width: 100%;
}
.card .img img{
height: 100%;
width: 100%;
object-fit: cover;
}
...Styles for other elements...
@media screen and (max-width: 978px) {
.container{
flex-wrap: wrap;
flex-direction: column;
}
.card{
max-width: 700px;
margin: 20px 0;
}
}