Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disadvantages to using CSS word-wrap globally?

Tags:

css

Are there any disadvantages to using word-wrap:break-word in the following way?

body
{
    word-wrap: break-word;
}

The descriptions of the values for this property are as follows:

  • normal: Break words only at allowed break points
  • break-word: Allows unbreakable words to be broken

Now, this only makes a difference in the breaking of unbreakable words (i.e. continuous strings that are longer than their containers). Otherwise, it'll make no difference for 99% of text anywhere.

So, are there any disadvantages to using this globally? It can certainly solve a lot of layout issues without (at least as far as I can see) having any adverse effects. It seems better to do this once than to have to apply it everywhere you could possibly have overflowing text that would mess up your layout.

like image 353
Jake Petroules Avatar asked Aug 04 '11 00:08

Jake Petroules


1 Answers

I can't think of any disadvantages since, if you want to have some other kind of word-wrap elsewhere, you'll always be able to override this global style.

That said, if you can at all narrow down the situations in which this will be necessary, using a broad class would be preferable. There's no telling what rare but very frustrating bugs a global break-word style will cause (and in what browsers).

like image 102
skybondsor Avatar answered Oct 12 '22 23:10

skybondsor