Reputation: 313
I have a CSS-related question here. I want to create a horizontal arrow, like this on screen shot (actually it was added in paint).
As a possible solution I thought of using the transform: skew
property, but I don't think it is possible to skew one element on left&right sides.
Any suggestion about this, please? :)
Upvotes: 1
Views: 116
Reputation: 3573
It's possible using "a single div" by taking advantage of the :before
and :after
selector.
.arrow {
margin: 50px;
width: 500px;
height: 40px;
}
.arrow:before {
content: '';
position: relative;
left: 0;
top: 0;
display: inline-block;
width: calc(50% - 2px);
height: 100%;
border: 1px solid red;
border-right-width: 0;
transform: skewY(10deg);
}
.arrow:after {
content: '';
right: 0;
top: 0;
position: relative;
display: inline-block;
width: calc(50% - 2px);
height: 100%;
border: 1px solid red;
border-left-width: 0;
transform: skewY(-10deg);
}
<div class="arrow"></div>
Upvotes: 4