1

I have a fixed width HTML page that has some dynamic copy/text injected into it. The text should be allowed to wrap, but not produce an orphan

e.g

Hi [first name], would you like to play a game?

Problem is since the [first name] is dynamic and could be any length, I can't seem to avoid sometimes having an orphan

e.g

Hi Guy-with-really-long-name, would you like to play a

game?

I can't use css "white-space: nowrap;" as it should be allowed to wrap, just not with an orphan.

I would also like a solution that will work on HTML email as well.

Any ideas?

Tushar Gupta
  • 15,504
  • 1
  • 29
  • 47
MakkyNZ
  • 2,215
  • 5
  • 33
  • 53

1 Answers1

1

just set white-space: nowrap for the last (e.g. four) words

Hi Guy-with-really-long-name, would you like 
<span style="white-space: nowrap">to play a game?</span>
Fabrizio Calderan
  • 120,726
  • 26
  • 164
  • 177