0

I have a List Item that on hover, changes its BG color and also makes the border right grow out from 0-7px. Within the list item there is a label for a radio input that is toggling content off and on when clicked. When the border grows, the label gets pushed over.

Is it possible to specify that on hover attributes X and Y happen to the list item, while triggering another css event to change the z-index of the label?

1

1 Answer 1

2

In general, if you want to hover over one element and this trigger an action on an adjacent element, just use plus sign. For example,

.hoverable:hover + .actionable {

Check out this codepen for a simple working example: http://codepen.io/Joi/pen/VKZqAX

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

2 Comments

But is it possible to have two different effects to those individual pieces?
Yes, you just have to have two separate rules (basically a rule each element type). I modified the codepen alittle bit so you can see how I can change both the div I'm hovering over and another one.

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.