What is the difference between word-wrap and word-break in css?

PHP中文网
Release: 2018-09-28 10:36:56
Original
2030 people have browsed it

this chapter will introduce to you the difference between What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css? and What is the difference between word-wrap and word-break in css? in css. it has certain reference value. friends in need can refer to it. i hope it will be helpful to you.

what are What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css? and What is the difference between word-wrap and word-break in css?? i believe there are still many people who are confused about it. they can only memorize What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?:break-word;What is the difference between word-wrap and word-break in css?:break- all; is used to force sentences to break up, or it may be because these two things are too confusing to pronounce and look similar, making it difficult to memorize them.

so what exactly are they? i found the following explanation on mozilla's official website:

What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?

What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?

What is the difference between word-wrap and word-break in css?

What is the difference between word-wrap and word-break in css?

we see that words like break lines within words appear in both explanations, indicating that they are related to breaking lines within words. then we try to translate the above two paragraphs in english:

What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?:

the What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css? attribute of css is used to indicate whether the browser is allowed break sentences within words to prevent overflow when a string is too long to find its natural break point.

What is the difference between word-wrap and word-break in css?:

the What is the difference between word-wrap and word-break in css? attribute of css is used to indicate how to break sentences within words.

it seems that we have found some differences between the two translations above that are painful to read: What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css? emphasizes whether to allow sentence breaks within words, while What is the difference between word-wrap and word-break in css? emphasizes how to break words. internal sentence fragments.

having said this, it seems that it is still not very clear. well, children with poor expression skills cannot afford to be hurt, so we can only use some examples to remedy the situation.

first of all, what is intra-word sentence segmentation? of course, these are all spanish words.

What is the difference between word-wrap and word-break in css?

this is the case without intra-word segmentation. we see that the word is too long, so it overflows the container that wraps it.

What is the difference between word-wrap and word-break in css?

this is the case of sentence segmentation within a word, that is, a word is segmented into two lines.

first of all, let’s be clear. when What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css? or What is the difference between word-wrap and word-break in css? is not added, it is the browser’s default setting. if a word is so long that the remaining space in a line cannot fit it. , the browser will move the word to the next line:

What is the difference between word-wrap and word-break in css?

word..d the word we created should originally be immediately after long, but long there is not enough space left at the end, and the word cannot be broken by default, so the browser has to condescend to move it down.

this long word is not considered abnormal, because at least it does not exceed the length of the element that wraps it, but what if it exceeds the length?

What is the difference between word-wrap and word-break in css?

if it exceeds, as we mentioned before, it will overflow outside its parent container, because it is not allowed to be truncated at this time, then only i can rush out.

this is where What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css? comes in handy. let’s add What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?:break-word to this text and see what happens

What is the difference between word-wrap and word-break in css?

What is the difference between word-wrap and word-break in css?

haha, go back here , abnormally long words, it doesn’t matter even if you break them.

in this way, in order to prevent long words from overflowing, sentences are broken inside them. this is what What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?:break-word does.

looking at the browser support of What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?:

What is the difference between word-wrap and word-break in css?

very good, almost all browsers support it.

okay, you can say now that you already have What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?, so why do you need What is the difference between word-wrap and word-break in css??

the evil capitalists always want to squeeze everything out of workers. look, isn’t there a space behind the long in the picture below? should it just be left like this? such a waste. . .

What is the difference between word-wrap and word-break in css?

yes, there is room for several short words after long, all of which are those stinky, perverted long words!

so ie is really considerate, don’t scold it anymore, considering the problem of not wasting a little bit of space, it created What is the difference between word-wrap and word-break in css?. now let's see what happens when we use What is the difference between word-wrap and word-break in css?:break-all;.

What is the difference between word-wrap and word-break in css?

What is the difference between word-wrap and word-break in css?

look what happened? the perverted long word was not moved to the next line, but placed directly after long, and then disconnected at the right border of the parent container. so, it doesn't waste space.

let’s take a look at the browser support for What is the difference between word-wrap and word-break in css?:break-all:

What is the difference between word-wrap and word-break in css?

except for opera, everything else supports it (firefox also supports it from it has been changed from not supported to supported)!

as we said at the beginning, What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css? is used to decide whether to allow sentence segmentation within a word. if it is not allowed, long words will overflow. the most important point is that it will still try to move to the next line first to see if the width of the next line is enough. if not, it will segment sentences within the word.

What is the difference between word-wrap and word-break in css?:break-all is even more abnormal, because the way it breaks sentences is very rough. it does not try to move long words to the next line, but directly breaks sentences within words. this can also explain why its function is to determine how to break sentences, that is - using What is the difference between word-wrap and word-break in css?:break-all is equivalent to using a rough way to break sentences. in a word, if you want to save more space, just use What is the difference between word-wrap and word-break in css?:break-all!

but in any case, sentence fragmentation within a word will have a certain impact on the readability of western texts. sometimes you need to pay attention to this.

ps: some articles on the internet say that What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?:break-word does not work on long strings of english. in fact, this is very wrong. What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?:break-word can still wrap a long string of english. or the number is split into multiple lines. in fact, What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?:break-word and What is the difference between word-wrap and word-break in css?:break-all have something in common in that they can forcibly break long words into sentences. the difference is that What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?:break-word will first create a new line to place the long word. if the long word still cannot be placed in the new line, the long word will be forced to break the sentence; What is the difference between word-wrap and word-break in css?:break-all will not put the long word in a new line. when the line cannot be placed, the sentence will be forced to break. .

css code:

.p1{
  background:#000; width:100px; color:#f00; What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?:break-word
}
.p2{
  background:#000; width:100px; color:#f00; margin-top:10px; What is the difference between word-wrap and word-break in css?:break-all
}
Copy after login

html code:

<p class="p1" data-mce-style="background: #000; width: 100px; color: #f00; What is the difference between word-wrap and What is the difference between word-wrap and word-break in css? in css?: break-word;">
haha 555555555555555555555555555555555
</p>
<p class="p2" data-mce-style="background: #000; width: 100px; color: #f00; margin-top: 10px; What is the difference between word-wrap and word-break in css?: break-all;">
haha 555555555555555555555555555555555
</p>
Copy after login

the above is the entire content of this chapter, you can try to compile it yourself

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!