5 images symmetrically seperated with diagonal lines
No need to use positioned element, you can simplify like this and use background-position
to center the element:
.container {
display: flex;
height: 150px;
margin: 0 30px;
}
.box {
flex: 1;
border: 1px solid;
transform: skew(-25deg);
position: relative;
overflow: hidden;
}
.box:after {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: -50%;
right: -50%;
transform: skew(25deg);
background-image: var(--i);
background-position: center;
}
<div class="container">
<div class="box" style="--i:url(https://lorempixel.com/400/200/)"></div>
<div class="box" style="--i:url(https://lorempixel.com/400/300/)"></div>
<div class="box" style="--i:url(https://lorempixel.com/300/200/)"></div>
<div class="box" style="--i:url(https://lorempixel.com/400/300/)"></div>
<div class="box" style="--i:url(https://lorempixel.com/200/300/)"></div>
</div>
UPDATE
Here is another version of the code which is more supported (especially for IE):
.container {
font-size:0;
height: 150px;
margin: 0 30px;
}
.box {
font-size:initial;
width:calc(100% / 5);
height:100%;
border: 1px solid;
box-sizing:border-box;
transform: skew(-25deg);
position: relative;
overflow: hidden;
display:inline-block;
}
.box span {
position: absolute;
top: 0;
bottom: 0;
left: -50%;
right: -50%;
transform: skew(25deg);
background-position: center;
background-size:cover;
}
<div class="container">
<div class="box">
<span style="background-image:url(https://lorempixel.com/400/200/)"></span>
</div>
<div class="box">
<span style="background-image:url(https://lorempixel.com/400/300/)"></span>
</div>
<div class="box">
<span style="background-image:url(https://lorempixel.com/200/200/)"></span>
</div>
<div class="box">
<span style="background-image:url(https://lorempixel.com/300/200/)"></span>
</div>
<div class="box">
<span style="background-image:url(https://lorempixel.com/400/400/)"></span>
</div>
</div>