so I’m trying to draw a polygon with the clip-path function in CSS.
I want a rectangle, which has a min-height of 90px and a arrow at the bottom side.
All I need is a extra polygon-point outside the 100% height.
I try:
.child {
width: 100%;
min-height: 90px;
max-height: none;
clip-path: polygon(
0 0,
40% 0,
50% 20%,
60% 0,
100% 0,
100% 100%,
60% 100%,
50% calc(100% + 10px),
40% 100%,
0 100%
);
}
So this one doesn’t run. It cannot add the 10px to the 100% height.
50% calc(100% + 10px),
Has someone a better idea?
2
Answers
Instead of exceeding the area just reduce all by 10px: use
100%
instead of100% + 10px
and use100% - 10px
instead of100%
. Optionally increase themin-height
by 10pxotherwise, make the bottom arrow using a pseudoelement so you can exceed the area
A playground that implements the general formula for Fabrizio’s answer: