I have a box with text. It shows only 2 lines by default and shows the whole text when the user hovers over it. However, I have a problem animating it. The display property seems to be not animatable.
How can I animate it?
If it helps, I'm also using "framer-motion" and it's okay if you have a workaround using it.
.box {
transition: all 0.3s ease-in-out; /* doesn't work */
}
.title {
color: green;
font-weight: bold;
}
.text {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
transition: all 0.3s ease-in-out; /* doesn't work */
}
.box:hover .text {
display: block;
}
<div class="box">
<span class="title">Title</span>
<div class="text">
Et eirmod erat diam ipsum sit diam ut et est at ut tempor consequat nisl duis ut justo sit. Aliquyam adipiscing et esse consetetur dolores et suscipit stet magna invidunt sea et sadipscing ea at magna labore. Molestie dolores justo consetetur consequat. Sed sit aliquyam eirmod amet nonummy facilisis diam. Diam lorem dolores stet labore eos duo illum facer qui justo duo stet consetetur diam magna.
</div>
</div>
Why it's not a duplicate question:
I want to specifically use the line-clamp
(or if there's a similar property) to limit the number of lines by the number I want. I don't want to use guesses or probability!