Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS word-break does not work correctly in Microsoft edge

It has come to my attention that in Microsoft Edge there is a problem with some css attributes, such as :

word-break: break-word;

Is there a way of fixing this or is there a way around this?

like image 610
Panchi Avatar asked Feb 13 '16 18:02

Panchi


People also ask

How do I fix word-break in CSS?

For English and many other languages, the correct breaking means hyphenation, with a hyphen added at the end of a line when a break occurs. In CSS, you can use hyphens: auto , though you mostly still need to duplicate it using vendor prefixes.

Does Microsoft EDGE support CSS?

CSS min/max-width/height is Fully Supported on Microsoft Edge 17.

How do I split a line after a word in CSS?

A line-break can be added in HTML, using only CSS, by employing the pseudo-class ::after or ::before . In the stylesheet, we use these pseudo-classes, with the HTML class or id, before or after the place where we want to insert a line-break. In myClass::after : Set the content property to "\a" (the new-line character).

Is break-word supported by edge or ie?

word-break: break-word is deprecated, and not supported by MS Edge or MS IE. See mozilla documentation about this. word-break is supported by MS Edge and MS IE Here is a list of supported browsers.

Which browsers support word-break?

word-break is supported by MS Edge and MS IE Here is a list of supported browsers. Alternatively mozilla documentation specifies that overflow-wrap: break-word; acts the way that you want word-break: break-word to function. Show activity on this post.

Is there a way to add a word break to text?

An alternative solution is to make use of the word-wrap property which IMHO behaves more 'intelligently' - meaning the word break will only be applied when the word is too long to fit into a line width, and won't be applied to words that can simply be moved in whole to the next line.

Does the CSS change on Edge web developer tool?

However, when I view the css on Edge web developer tool, it hasn't changed. I REALLY like Edge as my new preferred browser, but if I can't see the css changes on my fantasy football sites, I'll have to use another.


4 Answers

word-break: break-word is deprecated, and not supported by MS Edge or MS IE. See mozilla documentation about this.

word-break is supported by MS Edge and MS IE Here is a list of supported browsers.

Valid MS Edge and MS IE word-break properties are:

word-break: normal|break-all|keep-all|initial|inherit|unset;

Alternatively mozilla documentation specifies that overflow-wrap: break-word; acts the way that you want word-break: break-word to function.

like image 82
Chris Avatar answered Sep 16 '22 18:09

Chris


An alternative solution is to make use of the word-wrap property which IMHO behaves more 'intelligently' - meaning the word break will only be applied when the word is too long to fit into a line width, and won't be applied to words that can simply be moved in whole to the next line.

CSS:

word-wrap: break-word;

The word-wrap property is supported by most browsers and as of today I can certainly confirm it works in Microsoft Edge, IE11, Chrome, Firefox, Opera and Safari.

Note, word-wrap has now been renamed to overflow-wrap, with word-wrap now being an alternative name for that property, however overflow-wrap is not understood by Microsoft Edge so stick with using word-wrap for cross-browser compatability.

like image 30
David Avatar answered Sep 20 '22 18:09

David


The thing is that you have to provide width for container/text in order to use word-break: break-word property. The only way to avoid this is to use unofficial WebKit/Blink only word-wrap: break-word property: https://caniuse.com/#search=word-break

like image 38
Alexey S. Avatar answered Sep 18 '22 18:09

Alexey S.


It's also worth mentioning, that while word-break: break-word; is improper property , it's undocumented and non-standard property value in WebKit. This makes the word wrapping behave like word-wrap: break-word, but works with dynamic widths.

like image 29
librewolf Avatar answered Sep 16 '22 18:09

librewolf