小编Pau*_*tch的帖子

是否有可能抑制parent的:active伪类?

我有以下标记:

<div class="parent">
  I should change my color to green when clicked
  <div class="element">I should do nothing when clicked</div>
</div>
Run Code Online (Sandbox Code Playgroud)

这是相关的CSS:

.parent {
  width:200px;
  height:200px;
  background: red;
  color: #fff;
}
.parent:active {
  background:green;
}
.element {
  background:blue;
}
Run Code Online (Sandbox Code Playgroud)

有什么办法来防止触发.parent:active伪类时,.element点击是什么吗?点击没有运气e.stopPropogation()时尝试.element. 演示

html css jquery

5
推荐指数
1
解决办法
613
查看次数

标签 统计

css ×1

html ×1

jquery ×1