I am trying to create a list that scrolls horizontal in a card but only if it's conent exceeds parents dynamic width. I want the width to be dynamic but at the same time maintaining the width(size) of the cards inside. I have played with having fixed width and got it to work. But with dynamic width it seems like I cant find a solution. Help would be much appreciated.
.site-container {
max-width: 1200px;
}
body {
background-color: gray;
}
.card {
height: 114px;
width: 164px;
background-color: #eee;
border: 2px solid white;
border-radius: 8px;
}
.card-list{
display: flex;
overflow-x: scroll;
}
.card-list::-webkit-scrollbar{
display: none;
}
.vla {
display: flex;
flex-direction: row;
justify-content: flex-start;
margin-top:8px;
margin-left: 25px;
}
.page-content-card {
background-color: #ffffff;
border-radius: 8px;
margin-top: 8px;
position: relative;
height: 100%;
width: 100%;
padding: 16px;
resize: horizontal;
/*To show that content don't show scroll when shrunk */
overflow: auto;
max-height: fit-content;
max-width: fit-content;
}
.wrapper-big-card {
display: flex;
flex-direction: column;
border: 1px solid #eee;
border-radius: 8px;
margin-top: 4px;
width:100%;
}
.hover-wrapper {
border-radius: 8px;
padding: 8px;
}
.hover-wrapper:hover {
background-color: #eee;
}
<div class="site-container">
<div class="page-content-card">
<!-- Other content on site -->
<div class="wrapper-big-card">
<div class="hover-wrapper">
<div class="vla">
<div class="card-list">
<div class="card ">
</div>
<div class="card ">
</div>
<div class="card ">
</div>
<div class="card ">
</div>
<div class="card ">
</div>
<div class="card ">
</div>
<div class="card ">
</div>
<div class="card ">
</div>
<div class="card ">
</div>
<div class="card ">
</div>
<div class="card ">
</div>
</div>
</div>
</div>
</div>
</div>
</div>