My goal is to make both the <hr>
elements transition, but I'm struggling with only being able to select the lower <hr>
using CSS.
html {
margin-bottom: 0;
height: 100%;
min-height: 100%;
}
body {
margin-top: 0;
height: 100%;
min-height: 100%;
background-color: red;
}
hr {
transition: width 1s;
width: 5rem;
}
#container {
width: 50%;
height: 100%;
padding: 5rem;
background-color: white;
margin: auto;
}
#expand {
width: 100%;
height: 100px;
background: red;
transition: height 1s;
text-align: center;
}
#expand:hover {
height: 200px;
}
#expand:hover~hr {
width: 20rem;
}
<div id="container">
<hr>
<div id="expand">
Learn More
</div>
<hr>
</div>
Is there a way to achieve the desired transition for both the <hr>
elements using plain JavaScript? If not, which JavaScript library would be suggested?