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

后端 未结 12 832
暖寄归人
暖寄归人 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:10

    The :active pseudo-class applies while an element is being activated by the user. For example, between the times the user presses the mouse button and releases it. On systems with more than one mouse button, :active applies only to the primary or primary activation button (typically the "left" mouse button), and any aliases thereof.

    There may be document language or implementation specific limits on which elements can become :active. For example, [HTML5] defines a list of activatable elements.

    The parent of an element that matches :active also matches :active. So there,s no way

提交回复
热议问题