If I have markup like this:
<div>
<div class="one"></div>
</div>
<div class="two">
Is there any way in css that I can select class .two from class .one?
As in this fiddle.
If I have markup like this:
<div>
<div class="one"></div>
</div>
<div class="two">
Is there any way in css that I can select class .two from class .one?
As in this fiddle.
What you are trying is not possible using only CSS, what you can do is you can re arrange the element like this
<div>
<div class="one"></div>
<div class="two">
</div>
And use
.one:hover + .two {
/* Styles */
}
Else you can do is this (If you don't want to change the markup) Demo
div {
width: 50px;
height: 50px;
background: pink;
}
.two {
height: 20px;
background: #000;
width: 20px;
}
div:nth-of-type(1):hover + .two {
background: #f00;
}
.one + .two {
background: #f00;
}
you can do using jquery
script type="text/javascript">
$(function () {
$(".one").mouseover(function () {
$(".two").css("background","red")
});
$(".one").mouseout(function () {
$(".two").css("background", "");
});
});
</script>