I'm utilizing flexbox to design a horizontal slider in HTML. However, when using the code below:
<!DOCTYPE html>
<html lang="en>
<head>
<meta charset="UTF-8>
<meta http-equiv="X-UA-Compatible" content="IE=edge>
<meta name="viewport" content="width=device-width, initial-scale=1.0>
<title>Document</title>
<style>
.container{
width: 425px;
display: flex;
background-color: yellowgreen;
overflow-x: auto;
}
.container div{
width: 100px;
height: 150px;
margin: 10px;
background-color: teal;
}
</style>
</head>
<body>
<div class="container">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</body>
</html>
All div
elements automatically adjust their width and the container box does not have horizontal scroll.