How to adjusting div as background to text length?

I have a text in a div (Screenshot).
The div functions as a background color for the text.
I can do this manually by inserting another div+text for every line.
But when pulling data from an ACF, the text length is sometimes longer, going on 2 or more lines - especially on mobile.
Is there a way to fix this automatically? Thank you!

Hi

can you try with adding this CSS code to the Div:

width: fit-content;
float: left;

Cheers

Patric

Maybe this can help: HTML mark Tag (w3schools.com)