The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Use :hover to target another element

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #156858

    Hey guys, I’ve been wondering if it’s possible to make use of :hover state of an input field to target another element. Is that possible?

    I’ve tried to do this but didn’t have any success:

    Thanks in advance.


    you can use the “+” or “~” selector to choose the element after current;

    like this html

    input b b

    input:checked + b will take the element after input when it :checked(just one)

    input:checked ~ b will take all the element after input when it :checked.

    check the demo:

    bad english, hope you can understand.


    Pretty much the same as what singlexyz posted expect I edited your original pen. Might be easier to see whats going on.


    Thanks guys. I was trying to do the exact same thing you guys are suggesting. The problem is that I wanted to target an element that goes before the input I’m listening to. I don’t think that’s possible.

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