In my project, there are two elements: .parentElement
and .childElement
. Both have the :active
implemented to appear darker when pressed. The .childElement
is nested inside the .parentElement
.
I am looking for a way to prevent the .parentElement:active
from being triggered when the .childElement:active
is triggered.
In JavaScript, this can be achieved by using .stopPropagation()
. Is there an equivalent method in CSS to accomplish this?
In my current project, every heading is clickable, including the sub-headings. This essentially creates a button within a button scenario. When a user clicks on a heading, the page scrolls to the corresponding section. https://i.sstatic.net/hxn09.png