Is it possible to stop propagation by CSS?

情到浓时终转凉″ 提交于 2021-02-10 06:46:06

问题


With Javascript it is possible to stop propagation with code? E.g.

  function func1(event) {
      alert("DIV 1");
    if (document.getElementById("check").checked) {
      event.stopPropagation();
    }
  }

Is it also possible to stop propagation by CSS?


回答1:


Sort-of, in some browsers. You can use the 'all' property to reset an element back to initial values. That should mean the initial values inherit down from there.

Unfortunately it's not supported by IE and Edge though. https://www.caniuse.com/#search=all



来源:https://stackoverflow.com/questions/54764298/is-it-possible-to-stop-propagation-by-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!