Hover or focus the image to see the effect.
HTML
CSS
.hover-effect.diagonal-reveal{
position: relative;
display: block;
}
.hover-effect.diagonal-reveal::before{
content: "";
position: absolute;
inset: 0;
background: rgba(15, 23, 42, 0.85);
clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
transition: clip-path 0.5s ease;
pointer-events: none;
}
.hover-effect.diagonal-reveal:hover::before,
.hover-effect.diagonal-reveal:focus-visible::before{
clip-path: polygon(0 0, 0 0, 0 0, 0 0);
}
The ::before uses a polygon clip-path that collapses from a full rectangle to a single point at the top-left, producing a diagonal wipe on hover/focus. Select the code and copy with Ctrl+C or ⌘C.