In actual work, if we need to prohibit the click event of an element, we can set the pointer-events attribute of the element to none.
(Recommended tutorial: CSS tutorial)
is as follows:
Test code:
.disabled { pointer-events: none; cursor: default; opacity: 0.6;}
Among them, pointer-events: none; is a new attribute of CSS3, which means that mouse click events are prohibited. When this attribute is present in the element, all link and click events will be invalid.
The above is the detailed content of How to disable click events of elements in css. For more information, please follow other related articles on the PHP Chinese website!