I am trying to create triangle shaped pointer/border on a horizontal line.
Here is an example of what I am trying to achieve:
I tried manipulating the top border of a div, but everything I've done so far doesn't work at all.
The point at which Germany, France and Switzerland converge and boats sail off towards the North Sea is also a transport hub for the supply of raw materials to Switzerland. A unique meeting place for three countries, languages and cultures.
triangle element and pointer-events: auto; on the pseudo-elements). Otherwise, this could be achieved by wrapping . triangle in an element having the same width and height (and the same border-radius ) and overflow: hidden; .
There are several ways to achieve that and it probably depends on your layout. One solution is to use a rotated element with borders on two sides.
.triangle {
background: green;
border: 2px solid white;
border-width: 2px 2px 0 0;
transform: rotate(-45deg);
}
.box {
background: green;
width: 400px;
height: 80px;
position: relative;
}
.line {
height: 39px;
border-bottom: 2px solid white;
}
.triangle {
background: green;
border: 2px solid white;
border-width: 2px 2px 0 0;
transform: rotate(-45deg);
position: relative;
left: 300px;
top: 28px;
width: 20px;
height: 20px;
}
<div class="box">
<div class="line">
<div class="triangle">
</div>
</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With