I want to draw a triangle diagonally on the screen which changes colour on hover. My current attempt doesn't really hover on the triangle but a 'hack triangle' which in fact is a rectangle and doesn't care about the transparent section.
How could I possibly make this hoverable only when actually hovering on the triangle itself?
body {
padding: 0;
margin: 0;
}
.triangle {
width: 0;
height: 0;
border-style: solid;
border-width: 100vh 0 0 100vw;
border-color: transparent transparent transparent #007bff;
}
.triangle:hover {
border-color: transparent transparent transparent red;
}
<div class="triangle"></div>
The duplicate thread suggests an answer for fairly simple triangle, not like in my case where it takes up the whole width and height of the screen and each side's not identical.