您现在的位置是:首页 > 电脑 > 

按钮不可点击(Button is unclickable)

2025-07-27 20:23:36
按钮不可点击(Button is unclickable) 目前,我们使用平滑的ccs专用按钮,显示onclick的下推效果。 他们有一个奇怪的行为: .button { cursor: pointer; display: inline-block; color: #FFF; font-weight: normal;
按钮不可点击(Button is unclickable)

目前,我们使用平滑的ccs专用按钮,显示onclick的下推效果。 他们有一个奇怪的行为:

.button { cursor: pointer; display: inline-block; color: #FFF; font-weight: normal; border-radius: px; text-align: center; text-decoration: none; display: inline-block; background: #2a2f0; border: 0px; border-bottom: 2px solid #1e87cc; padding: 10px 0px; } .button:hover { background: #1e87cc !important; border-bottom: 2px solid #0169AD; } .button:active { border-bottom: 0px !important; border-top: 2px solid #0169AD; margin-top: 2px; padding-top: 10px; padding-bottom: 8px; }

http:///6SeG8/

问题是:单击顶部2至4像素处的按钮时,单击事件不会触发。 css:active状态确实会触发,但按钮的动作不会触发。

Currently we make use of nice flat ccs-only butt that show a push-down effect onclick. They have a weird behaviour:

.button { cursor: pointer; display: inline-block; color: #FFF; font-weight: normal; border-radius: px; text-align: center; text-decoration: none; display: inline-block; background: #2a2f0; border: 0px; border-bottom: 2px solid #1e87cc; padding: 10px 0px; } .button:hover { background: #1e87cc !important; border-bottom: 2px solid #0169AD; } .button:active { border-bottom: 0px !important; border-top: 2px solid #0169AD; margin-top: 2px; padding-top: 10px; padding-bottom: 8px; }

http:///6SeG8/

The problem is: When clicking the button at the top 2 to 4 pixels, the click event will not trigger. The css :active state does trigger, but the action of the button does not.

最满意答案

考虑使用after伪元素:

.button:active:after{ content: " "; position: absolute; top: -4px; left: 0; width: 100%; height: 100%; }

的jsfiddle

请注意,它在IE7及更早版本中不起作用。

Cider using an after pseudo-element:

.button:active:after{ content: " "; position: absolute; top: -4px; left: 0; width: 100%; height: 100%; }

JSFiddle

ote, that it doesn't work in IE7 and earlier.

#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/diannao/49261.html

相关标签:无
上传时间: 2023-04-13 21:41:45
留言与评论(共有 14 条评论)
本站网友 桂枝茯苓胶囊
10分钟前 发表
0px !important; border-top
本站网友 李可染书法
9分钟前 发表
0; width
本站网友 67yyy
5分钟前 发表
2px; padding-top
本站网友 瓶窑租房
29分钟前 发表
#1e87cc !important; border-bottom
本站网友 蜗居男主角
16分钟前 发表
active { border-bottom
本站网友 促排卵的食物
3分钟前 发表
0; width
本站网友 爱的雷达
26分钟前 发表
but the action of the button does not. 最满意答案 考虑使用after伪元素: .button
本站网友 数据库下载
12分钟前 发表
absolute; top
本站网友 沈阳糖酒会
16分钟前 发表
100%; } JSFiddle ote
本站网友 洪武
28分钟前 发表
2px; padding-top
本站网友 出其不意下一句
25分钟前 发表
Cider using an after pseudo-element
本站网友 百合花怎么养
21分钟前 发表
inline-block; color
本站网友 郑州美景鸿城二手房
23分钟前 发表
normal; border-radius