If you want to add a special design element to each div, you can use the :before pseudo-element.
This method is useful for creating sliders and doesn't require any additional HTML code. Simply insert your div elements within the existing structure.
body{
background-color:#999;
}
.main{
width:300px;
height:100px;
background-color:#999;
}
.div1{
width:50%;
height:100%;
background-color: blue;
float:left;
position:relative;
overflow:hidden;
}
.div1:before{
content:"";
dislpay:inline-block;
width:20px;
height:110%;
background-color:#fff;
position:absolute;
transform:rotate(10deg);
right:0px;
transform-origin: bottom;
}
.div2{
width:50%;
height:100%;
background-color: red;
float:left;
position:relative;
overflow:hidden;
}
.div2:before{
content:"";
dislpay:inline-block;
width:20px;
height:110%;
background-color:#fff;
position:absolute;
transform:rotate(10deg);
left:-20px;
top:-5px;
transform-origin: bottom;
}
<div class="main">
<div class="div1"></div>
<div class="div2"></div>
</div>
To see an example of this code in action, visit: https://codepen.io/miladfm/pen/owBOKK