Search code examples
cssword-break

CSS word-break gives error


.word-break {
    -ms-word-break: break-all;
    word-break: break-all;
    word-break: break-word;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    hyphens: auto;
    white-space: pre-line;
}

Source : CSS-TRICKS

I have used above for word break.But it's giving below mentioned error.

Note : My Editor is VS 2013

enter image description here

So how can I get rid of the above error ? Any help would be highly appreciated.


Solution

  • You get rid of the error message in a browser’s console by removing the declaration word-break: break-word;. This declaration, in addition to being invalid according to CSS Text Module Level 3 LC, is actively harmful. Ignored by most browsers, it appears to be recognized by Chrome, presumably so that break-word is taken the same as or similar to the initial value normal, overriding the preceding declaration.

    Note that the hyphens declarations in this rule have no effect under any normal circumstances. The word-break: break-all declaration tells the browser that it may break arbitraril y anywhere, so it has no reason to try any hyphenatio n.