Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "anywhere" mean in "word-wrap" css property?

Tags:

css

word-wrap

I just noticed in Firefox (I assume it's the same in Chrome) a new property value called "anywhere" of a property "word-wrap". What does it do? I remember using normal (which is default) or break-word (for most uses) but what does "anywhere" mean? How is it different from "break-word"? Mozilla.org doesn't have it listed in their manual (yet?)

"anywhere" seems to do the same thing "break-word" does. I'm seeing this in Firefox 67.0

word-wrap: anywhere;

I don't really know what to make of it. Is it usefull? Has it always been there all this time and I just missed it?

like image 494
Glenn Carver Avatar asked May 25 '19 11:05

Glenn Carver


People also ask

What is word-wrap anywhere?

Soft wrap opportunities introduced by anywhere are considered when calculating min-content intrinsic sizes. and later you can read: break-word. As for anywhere except that soft wrap opportunities introduced by break-word are not considered when calculating min-content intrinsic sizes.

What is overflow-wrap anywhere?

The overflow-wrap property in CSS allows you to specify that the browser can break a line of text inside the targeted element onto multiple lines in an otherwise unbreakable place. This helps to avoid an unusually long string of text causing layout problems due to overflow.

What is word-wrap property in CSS?

Definition and Usage The word-wrap property allows long words to be able to be broken and wrap onto the next line.

What is mean by WRAP in CSS?

The word-wrap property in CSS is used to break long word and wrap into the next line. It defines whether to break words when the content exceeds the boundaries of its container.


1 Answers

Refer to the specification to find the definition:

anywhere

An otherwise unbreakable sequence of characters may be broken at an arbitrary point if there are no otherwise-acceptable break points in the line. Shaping characters are still shaped as if the word were not broken, and grapheme clusters must stay together as one unit. No hyphenation character is inserted at the break point. Soft wrap opportunities introduced by anywhere are considered when calculating min-content intrinsic sizes.

and later you can read:

break-word

As for anywhere except that soft wrap opportunities introduced by break-word are not considered when calculating min-content intrinsic sizes.


Simply notice that the browser support is quite limited:

enter image description here

https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap#Browser_compatibility

like image 93
Temani Afif Avatar answered Oct 02 '22 07:10

Temani Afif