CSS- force words to new line rather than word-breaking

Eric Holmes picture Eric Holmes · Dec 20, 2012 · Viewed 7.1k times · Source

My client wants no words to be broken on his site. Example:

The dog went for a walk and ran to-
wards the car.

SHOULD BE

The dog went for a walk and ran 
towards the car.

The issue is only appearing in Safari. Does anyone know the CSS property to solve this?

Answer

Jukka K. Korpela picture Jukka K. Korpela · Dec 20, 2012

Add the CSS rule

* { -webkit-hyphens: none; }

The only situations where Safari would hyphenate a word (which is what happens according to the description) are an explicit hyphenation hint, as in to­wards, or via automatic hyphenation via -webkit-hyphens: auto. Safari has been described as supporting automatic hyphenation, but this does not seem to apply to the Windows version (5.1.7). Anyway, the rule above helps either way.

On the other hand, it might be better to prevent just undesired hyphenation.