I don't really understand the reason behind this behavior: http://codepen.io/gasim/pen/NPyjXB. I am trying to create an angled border with ::before, ::after selectors. The layout is in the following way:
<div class="container">
<div class="side left"></div>
<div class="text">Hello World</div>
<div class="side right"></div>
</div>
The end of left side and the beginning of right side should have angled borders. So, I decided to use ::before and ::after since it gives me much more power on what I want to show:
.side {
position: relative;
width: 20%;
}
.side.left::after {
content: "";
position: absolute;
top: 0;
right: -15px;
width: 20px;
height: 50px;
background: #1EAFEF;
-webkit-transform: skewX(15deg);
}
.side.right::after {
content: "";
position: absolute;
top: 0;
left: -15px;
width: 20px;
height: 50px;
background: #1EAFEF;
-webkit-transform: skewX(15deg);
}
The Left side does exactly what I want it to do. However, the right side doesn't. It goes to the next line, which doesn't make any sense because I am using absolute positioning to NOT to have that issue :/
Can someone explain to me why this happens?
EDIT: Here is my expectation: