I want to create a triangle and set a link (changing cursor etc) only to the visible area of this triangle, leaving the transparent area untouched and unlinked.

All the solutions here, I tried to modify but the cursor and the link were in all the rectangle area, not only in the visible triangle. Is there any possibility to do that?

1

There are 1 answers

0
Paulie_D On BEST ANSWER

Use a clip path

div {
  width: 200px;
  aspect-ratio: 1;
  background: red;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

div:hover {
  background: green;
}
<div></div>