A core foundation of the web is text. Text is information, and the internet is essentially the largest source of information available.

With responsive web design being a basic tenet of proper web development, we have to pay attention to how text wraps at all of our breakpoints. Hanging words, also called widows, are both unattractive and considered to decrease legibility. Here’s a favorite solution of mine to preventing hanging words. 

I used to wrap the last 2 (or 3 words) in a <span style=display:inline-block></span>. Personally I think this is kind of messy. Sure, we could make a utility class of .display-inline-block and use that within the <span>, but it would only increases our CSS. 

Instead, I prefer to insert &nbsp;, rather than a standard space, between whichever words I want to keep grouped at all breakpoints.

Leave a Reply