Recalculate width:auto after linebreak

Viewed 183

We have text-elements with defined spacings in between them. They can be multiline. Now if the text breaks inside of them, width:auto is not correct - it somehow should be recalculated after the text broke onto new lines.

Current situation:

enter image description here

Desired situation:

enter image description here

I created a simple fiddle for it: https://jsfiddle.net/zd73vfne/

max-width: 260px

is just for demonstration purposes, so the text breaks. Using word-break is not an allowed solution per requirement.

I've added another example with multiple boxes next to eachother, which shows the problem even better: https://jsfiddle.net/zd73vfne/2/

Is there a pure CSS solution?

0 Answers
Related