I am trying to emulate the Chrome/Firefox Inspector Highlighting effect using just CSS. I can achieve it relatively well but...
If a child element is hovered, its parent is highlighted aswell. Do you know how I can fix this? In the below example hover over the header and you will see pretty much everything is highlighted. Only the header should be red.
*:hover {
position: relative;
}
*:hover::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255,0,0,0.25);
}
<main style="height: 600px; position: relative;">
<header style="height: 100px;">Title</header>
<footer style="height: 100px; position: absolute; bottom: 0; width: 50%;">Footer</footer>
</main>