
我们可以为按钮添加“cursor: not-allowed”与“pointer-events:none”两种css样式实现按钮不可点击。
按钮不可点击主要是两种表现:
1、按钮不可点击时的显示状态
cursor: not-allowed
样式演示:
<style>
input[readonly] //readonly:后台能接收此input框传值
{
background:#dddddd; //为带有readonly的input框添加背景颜色
cursor: not-allowed // 表示一个红色的圈加一个斜杠
}
</style>2、按钮原有的事件不能实现
pointer-events:none
样式演示:
<style>
input[disabled] //disadled:后台不可接收此input传值
{
background:#dddddd; //为带有disabled的input框添加背景颜色
pointer-events:none;//鼠标点击不可修改
}
</style>以上就是css如何设置按钮不可点击?的详细内容,更多请关注易知道|edz.cc其它相关文章!












