I'm struggling to get a flexbox layout working with margins and overflow: hidden
.
The carousel component I'm integrating uses this method to be responsive but as soon as a display:flex
is applied to the parent, the margin
and overflow: hidden
properties are ignored as shown in the example below.
The top version is not nested in a flexbox where as the one below it is, and is not respecting the margins of the parent.
The issue is demonstrated in the code below and in this Plunker. http://plnkr.co/edit/qU1oq1Vq1X3FQMWLJiQk?p=preview
body {
margin: 400px;
}
.overflowHidden {
overflow: hidden;
}
.flex {
display: flex;
}
<div>
<div class="overflowHidden">
<img src="http://lorempixel.com/600/400" />
</div>
</div>
<div class="flex">
<div>
<div class="overflowHidden">
<img src="http://lorempixel.com/600/400" />
</div>
</div>
</div>
I know there are many similar questions on this topic but I couldn't find anything relating to my particular use case.