expandable text - too much space

Hi,
I’m not sure I fully understand the scenario, when the long text is collapsed you can see the space?
Please share the code you are using to collapse and expand the long text.