Forums

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

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #33872
    cayoub88
    Member

    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

    #84792
    a:hover + .box {
    background: red; /* Place rules here */
    }

    See here for more info: https://css-tricks.com/5514-child-and-sibling-selectors/

    #84796
    cayoub88
    Member

    Right what I wanted to know. Thanks!

    #84907
    tyrons
    Member

    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:

    Is it possible to change something in the .wrap div when hovering the anchor tag, for example? Using Javascript (jQuery), it is achievable.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.