The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › Controlling an element with another element
Hi Guys,
Not so sure if that’s been discussed around here before.
I found something similar, but doesn’t really answer my question.
Take this jsfiddle:
So when hovering over the entire .container, i can control any child element inside it.
This is similar to what I found on these forums.
My question is, how do i control the .box div, with the anchor tag…
I feel really dumb asking, but that’s the only way I can learn.
Thanks
a:hover + .box { background: red; /* Place rules here */ }
See here for more info: https://css-tricks.com/5514-child-and-sibling-selectors/
Right what I wanted to know. Thanks!
Great contribution!
Something that always intrigues me is the opposite. Is it possible to control a parent element from a descendent?
Take the same previous jsfiddle example:
Clicky
Is it possible to change something in the .wrap div when hovering the anchor tag, for example? Using Javascript (jQuery), it is achievable.