BlackMath
BlackMath

Reputation: 992

anchor tag doesn't work within div with :before pseudo element

I have a code something like this

<div class="container">
   <a target="_blank" href="http://www.google.com">Google</a>
</div>

where I use the pseudo element ::before in container to set a background image with opacity for the container div. However, when I set the background image using the ::before pseudo element, I cannot click on the anchor tag, and when I remove the pseudo element, it works fine. How can I go around this issue by keeping the background image?

Thanks

Upvotes: 0

Views: 273

Answers (1)

ray
ray

Reputation: 27245

Set pointer-events: none on the pseudo to let clicks pass through it.

Upvotes: 2

Related Questions