I have two elements and I'd like to trigger the hover of second element when the first element is hovered over.
Example:
#element1 {
border: 1px solid rgba(80,80,80, .5);
}
#element2 {
margin-top: 10px;
padding-top: 10px;
border: 1px solid rgba(80,80,80, .5);
}
/* suggested proposal */
#element1:hover >> #element2:hover {
font-weight: bold;
}
<div id="element1">
Hover over this element for more info
</div>
<div id="element2">
Here is more info
</div>
I'd like to know if it's possible yet OR if there any plans for this in CSS specification. If there's no proposals I can suggest something like #myElementId:hover >> #mySecondElementID:hover
.
There are a few related questions to this but acknowledges that it is not possible and with the new follow
feature people can follow for any updates.
Related Questions:
Triggering :hover on second element when hovering on first
Do not close. This is not the same as the other questions. It is asking about current status, future specification and gives a place to answer.
UPDATE:
It looks like I can select any element as the second element as long as it's sibling or a descendant of the first element.
Reference to combinators:
https://developer.mozilla.org/en-US/docs/Web/CSS/Adjacent_sibling_combinator
Update: The question is specifically about selecting a second element any where on the page. The current answers will work as long as the mentioned conditions are met.