I have a Flex container, with overflow-x:scroll
but the content gets clipped.
Can someone please explain why even with scroll content gets clipped?
And if i move overflow-x:scroll
to .row
and add flex-shrink:0
to child
then the right padding of Container .ctr
gets clipped.
.ctr{
display: flex;
justify-content: center;
}
.row{
display:flex;
padding:20px 20px;
overflow-x: scroll
}
Why .ctr
padding left works, but padding right doesnt ?
Please test in small viewports <600px
.ctr{
display: flex;
justify-content: center;
overflow-x: scroll
}
.row{
display:flex;
padding:20px 20px;
}
.row .child {
margin-right:20px;
}
.row .child:last-child{
margin-right:0;
}
.child{
min-width:0;
width:600px;
height:100px;
background: red;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class="ctr">
<div class="row">
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
</div>
</div>
</body>
</html>