Created
December 25, 2023 20:10
-
-
Save bartveneman/c2b828dcd63340177e12a5100041ac7b to your computer and use it in GitHub Desktop.
Fully clickable element with link inside
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Make entire parent clickable from a link within: | |
* | |
* <element class="coverable"> | |
* <a class="coverable-link" href="https://example.com">Example</a> | |
* <img src="https://example.com/image.jpg"> | |
* </element> | |
*/ | |
.coverable { | |
position: relative; | |
} | |
.coverable-link::after { | |
content: ''; | |
position: absolute; | |
top: 0; | |
right: 0; | |
bottom: 0; | |
left: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment