Jump to content

:checked moves an object

Zuccers

Hello, I really need help with css. I don't know what to do, i have a checkbox and when it's checked i want an object to move, but it doesn't work for me :/

My useless code:

#menuToggle [type=checkbox]:checked + .tab{
    top: 30%;
    position: absolute;
}

Any help would be great!

Link to comment
Share on other sites

Link to post
Share on other sites

Assuming that #menuToggle and .tab are adjacent elements, the mistake is probably that checkbox should be in quotes. That is, the top line should be:

#menuToggle[type='checkbox']:checked + .tab {

 

Link to comment
Share on other sites

Link to post
Share on other sites

10 hours ago, WatermelonLesson said:

Assuming that #menuToggle and .tab are adjacent elements, the mistake is probably that checkbox should be in quotes. That is, the top line should be:


#menuToggle[type='checkbox']:checked + .tab {

 

Doesn't work ?

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×