If you click the button “show ads”, it is like the following.
For removing the useless empty spaces,
I think that seperating the button and display target area can be a solution.
if the dynamic text in the button is short, the button area in black becomes small in width regardless of the display target area.
if the dynamic text "ads ads ads ads ads ads ads ads ads ads ads ads ads ads ads” of the display area becomes just “ads”, the white display area becomes small in width regardless of the button area.