Home  >  Article  >  Web Front-end  >  How to set the button to be unclickable in css

How to set the button to be unclickable in css

coldplay.xixi
coldplay.xixiOriginal
2021-04-29 17:19:115123browse

How to set the button to be unclickable in css: 1. The display state when the button is not clickable [cursor: not-allowed]; 2. The original event of the button cannot be implemented [pointer-events:none].

How to set the button to be unclickable in css

The operating environment of this tutorial: windows7 system, css3 version, DELL G3 computer.

How to set the button to be unclickable with css:

We can add two css styles: "cursor: not-allowed" and "pointer-events:none" to the button Make the button unclickable.

The button is not clickable mainly due to two manifestations:

1. The display state when the button is not clickable

cursor: not-allowed

Style demonstration:

<style> 
    input[readonly]   //readonly:后台能接收此input框传值
    {
         background:#dddddd; //为带有readonly的input框添加背景颜色
         cursor: not-allowed  // 表示一个红色的圈加一个斜杠
    }
</style>

2. The original events of the button cannot be implemented

pointer-events:none

Style demonstration:

<style> 
    input[disabled] //disadled:后台不可接收此input传值
    {
         background:#dddddd; //为带有disabled的input框添加背景颜色
         pointer-events:none;//鼠标点击不可修改
    }
</style>

Related tutorial recommendations: CSS video tutorial

The above is the detailed content of How to set the button to be unclickable 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