Home  >  Article  >  Web Front-end  >  How to disable click events of elements in css

How to disable click events of elements in css

王林
王林forward
2020-09-28 16:38:126582browse

How to disable click events of elements in css

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:

How to disable click events of elements in css

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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete