Home  >  Article  >  Web Front-end  >  css当点击容器内的元素时,如何绑定到容器的点击事件_html/css_WEB-ITnose

css当点击容器内的元素时,如何绑定到容器的点击事件_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:57:35850browse

<div class="btn-today glow three-btn">    <span class="rb">本        <span class="rt">ben</span>    </span></div>

.btn-today:active{    background: rgb(255,255,255);}

当我点击内的'本'时无法激活样式btn-today:active,点击之外是可以激活的。
有什么写法可以解决这个问题?谢谢。。。。


回复讨论(解决方案)

应该是 .rb:active{
    background: rgb(255,255,255);
}吧

.btn-tody>span{
    pointer-events: none;
}

.btn-tody>span{
    pointer-events: none;
}


pointer-events是可以忽略上层的事件还是忽略并激活下层的事件呢,我试了一下没有变化。
我要容器的背景变色,同样的页面,IE有这个问题,FF,Chrome没有问题
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