
How to Prevent Elements Receiving Click Events With CSS
Simply set none
for pointer-events
in CSS, if you want to avoid receiving click events for an element or you want it to be click-through:
Copied to clipboard!
.no-click {
pointer-events: none;
}
This comes especially useful if you have decorative elements covering another element that should receive click events. By using the above property, you can make sure that the click goes right through the element.


Resources:
π More Webtips
Master the Art of Frontend
Access exclusive interactive lessons
Unlimited access to hundreds of tutorials
Remove ads to learn without distractions
Courses

CSS - The Complete Guide (including Flexbox, Grid and Sass)
Including Flexbox, Grid, and Sass
Whether you're learning CSS for the first time or brushing up on your CSS skills and diving even deeper, this course is for you. Every web developer has to know CSS.

The HTML & CSS Bootcamp
From Zero to Expert!
This course covers flexbox, CSS grid, animations, responsive design, and much more! You will find tons of exercises & projects inside this course.

The Creative HTML5 & CSS3 Course
Build Awesome Websites
Learn HTML5 and CSS3 by creating three amazing, well-designed and animated websites from scratch.