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

How to implement non-clickable functional styles in css

青灯夜游
Release: 2021-07-02 16:35:54
Original
3606 people have browsed it

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;
Copy after login

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;
Copy after login

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 use cursor:not-allowed; and then use js code to prevent the event from being triggered;

cursor:not-allowed;
pointer-events:none;
Copy after login

(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!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template