I have a sample which changes the CSS of the other element.
Unfortunately, the CSS :hover
pseudo class, as well as CSS selectors make remote controlling other elements tricky, so you will have to use JavaScript.
In this case, hovering over one div
triggers the mouseover
event, which is set to add the other
class to the other element. Moving the mouse out triggers the mouseout
event, which will remove that class.
I have written the JavaScript in four separate parts, but, with more experience, it is possible to be a little more subtle.
To illustrate the point, I simply change the background colour. Obviously, this is where you might do something more meaningful.
document.querySelector('div.top').onmouseover=function(event) {
document.querySelector('div.bottom').classList.add('other');
}
document.querySelector('div.top').onmouseout=function(event) {
document.querySelector('div.bottom').classList.remove('other');
}
document.querySelector('div.bottom').onmouseover=function(event) {
document.querySelector('div.top').classList.add('other');
}
document.querySelector('div.bottom').onmouseout=function(event) {
document.querySelector('div.top').classList.remove('other');
}
div.other {
background-color: pink;
}
<div class='wrapper'>
<div class='top'>
<p>scale</p>
</div>
<div class='bottom'>
<p>hover</p>
</div>
</div>