I've got two divs, underneath each other.
When someone hovers over div1, I want it to make it move to the left, as well as make div2 underneath it move to the right.. I've had an attempt at this, but can't seem to complete it..
Here's my code:
<div id="mainbox">
<p>bla bla bla text</p>
</div>
<br />
<footer id="mainbox" style="height: 77px;">
<div id="mainbox2">
<p>bla text text</p>
</div>
</footer>
#mainbox {
transition: .4s;
-moz-transition: .4s;
-webkit-transition: .4s;
-ms-transition: .4s;
background: red;
border-radius: 40px;
}
#mainbox:hover {
transition: .4s;
-moz-transition: .4s;
-webkit-transition: .4s;
-ms-transition: .4s;
margin-left: -5%;
}
#mainbox:hover ~ #mainbox2 {
margin-left: -5%;
}
Here's a JSFIDDLE: https://jsfiddle.net/payw97w0/1/