I'm wondering if there is a way to add a link to a pseudo element. I thought it would work with content: url(), but it isn't
content: url('https://google.com');
width: 100px;
height: 100px;
}
I'm wondering if there is a way to add a link to a pseudo element. I thought it would work with content: url(), but it isn't
content: url('https://google.com');
width: 100px;
height: 100px;
}
As I searched about it, it seems that it is not possible by the standard way. But you can achieve this through some workarounds. Here is the solution I can think of:
<div class="clickable-pseudo">
<a href="-- your desired url --" target="_blank"></a>
</div>
div.clickable-pseudo::after{
content: "";
width: 30px;
height: 30px;
background-color: indianred;
display: block;
position: relative;
}
a{
position: absolute;
top:0px;
left: 0px;
width: 30px;
height: 30px;
display: block;
z-index: 10;
}
The above code simply puts the anchor tag on the pseudo element.