How can I create a function that enlarges item 2 when hovered over, while causing item 1 to shrink and rotate its text?
Is there a way to achieve this effect using CSS or JavaScript?
Currently, I have managed to make the hover effect work on item 1, where item 2 shrinks.
This is my current code snippet:
container {
width: 100%;
display: flex;
}
h2 {
font-size: 40px;
}
#box1 {
position: relative;
background: #154c79;
height: 600px;
color: white;
text-align: center;
float: left;
flex: 1;
}
#box1:hover {
transition: width 2s;
text-align: center;
flex: 10;
}
#box1:hover~#box2 {
writing-mode: vertical-lr;
text-orientation: upright;
text-align: center;
font-size: 50px;
flex: 1;
}
#box2 {
position: relative;
background: #FBCEB1;
height: 600px;
color: white;
text-align: center;
float: right;
flex: 1;
}
#box2:hover {
transition: width 2s;
text-align: center;
flex: 10
}
#box2:hover~#box1 {
writing-mode: vertical-lr;
text-orientation: upright;
text-align: center;
font-size: 50px;
flex: 1;
}
<div class="container">
<div id="box1">
<h2>Box 1</h2>
</div>
<div id="box2">
<h2>Box 2</h2>
</div>
</div>