I have a problem with a translated flex item still occupying its original space so that the following flex item does not immediately follow. Please see JSFiddle or snippet for more details. I want the green rectangle to follow immediately after the red so that is will be visible within the border. I can unfortunately not translate the parent, it will have overflow: hidden so that only the child within the border is visible.
Here is a JSFiddle https://jsfiddle.net/3wv9d9dm/
Or a snippet:
.parent {
display: flex;
width: 100px;
margin-left: auto;
margin-right: auto;
border: 1px solid black;
}
.child {
flex: 0 0 100%;
}
<div class="parent">
<div class="child" style="background-color:red;transform:translateX(-100%);"><h1>1</h1></div>
<div class="child" style="background-color:green;"><h1>2</h1></div>
<div class="child" style="background-color:blue;"><h1>3</h1></div>
</div>