Home >Web Front-end >CSS Tutorial >How to disable button clicks in css

How to disable button clicks in css

WBOY
WBOYOriginal
2021-12-10 16:10:3310930browse

In css, you can use the "pointer-events" attribute to prohibit clicks on the button element. This attribute is used to set whether the element responds to pointer events. When the value of the attribute is none, the element will be prohibited from being clicked. Click, the syntax is "button element {pointer-events:none;}".

How to disable button clicks in css

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

How to prohibit button clicks in css

In css, you can use pointer-events The attribute sets the button element to disable clicks, and the pointer-events attribute defines whether the element responds to pointer events.

The syntax of this attribute is as follows:

pointer-events: auto|none;

The value of the attribute:

How to disable button clicks in css

##The example is as follows:

<html>
    <head>
        <style>
        .css1{
          pointer-events:none;
          }
        </style>
    </head>
    <body>
        <button class="css1">已经设置不可点击的按钮</button>
        <button class="css2">没有设置不可点击的按钮</button>
    </body>
</html>

Output result :

How to disable button clicks in css

(Learning video sharing:

css video tutorial)

The above is the detailed content of How to disable button clicks 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