I have a paragraph tag on a site in which I replace the contents of when a button is clicked (using Javascript) (ie: replace quote #1 with quote #2). I'm not simply expanding on the current text, sometimes the new text may be less than the current text, sometimes more.
In some cases, the text goes from a short about to a longer amount which causes a rather jerky movement on the site as the <p>
tag increases it's height instantly.
I thought by adding a css transition of 2s might fix it, but it has no effect:
p.my-text {
transition: 2s;
}
Is there is a way to transition the height of a <p>
tag smoothly when the text is updated?