1
.menu:hover ~ .mts, .menu:hover ~ .mts2{

    background: #666666;

}

I have 3 divs and frist one is class=menu which is the main one, other two are inside him. On hover the main one I want to change color for those two... Why this is not working I saw on answers this answer but still it is not working.

3 Answers 3

1

If .menu is parent then no need to use ~ a space is enough.

.menu:hover .mts, .menu:hover .mts2{
    background: #666666;
}

~ means next siblings not children's.

Sign up to request clarification or add additional context in comments.

Comments

0

try this:

.menu:hover > .mts,  .menu:hover > .mts2 { background: #666666; }

If it does not work the background property may be overridden by some inline css of other rules somewhere else, in that case you may try to apply !important as last solution

Comments

0

check out this pen : http://codepen.io/Debabrata89/pen/WwKKYQ

.menu:hover  .mts, .menu:hover .mts2{
     background: orange;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.