Home>Article>Web Front-end> How to implement non-clickable functional styles in css

How to implement non-clickable functional styles in css

青灯夜游
青灯夜游 Original
2021-07-02 16:35:24 3445browse

Implementation method: 1. Directly add the "pointer-events:none;" style to the element to prohibit triggering events and make it non-clickable. 2. First add the "cursor:not-allowed;" style to the element; then use js code to prevent the click event from being triggered, making it non-clickable.

How to implement non-clickable functional styles in css

The operating environment of this tutorial: Windows 7 system, CSS3 version, Dell G3 computer.

Style when the mouse is not clickable

cursor:not-allowed;

The effect is as follows:

It should be noted that, although The style is not clickable, but clicks will still trigger the corresponding event.

Prohibit triggering events

pointer-events:none;

Using this style will prevent the event from being triggered. The mouse will be displayed in an arrow style;

If these two styles are used at the same time, the triggering of the event will be prevented, but the mouse will not be displayed in a disabled style as we want. Instead, it appears as an arrow style.

So when we implement the effect, we can usecursor:not-allowed;and then use js code to prevent the event from being triggered;

cursor:not-allowed; pointer-events:none;

(Learning video sharing:css video tutorial)

The above is the detailed content of How to implement non-clickable functional styles in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn