CSS: Prevent parent element getting :active pseudoclass when child element is clicked

后端 未结 12 894
暖寄归人
暖寄归人 2021-01-07 16:19

JSFiddle

When you click the button, you see that :active pseudoclass is triggered for the parent div. Is ther

12条回答
  •  粉色の甜心
    2021-01-07 17:00

    CSS pseudo-elements are incredibly useful -- they allow us to create CSS triangles for tooltips and perform a number of other simple tasks while preventing the need for additional HTML elements. To this point, these pseudo-element CSS properties have been unreachable by JavaScript but now there's a method for getting them!

    Check this:

    http://davidwalsh.name/pseudo-element

    http://davidwalsh.name/ways-css-javascript-interact

提交回复
热议问题