CSS3 word-wrap property
The function of the CSS3 word-wrap property is to allow very long words to be switched to the next line. Most of the browser defaults are to keep very long words intact, and directly jump to the next line or make the word exceed the DIV area. The range of the block , if neither of these two situations is the effect that the designer wants to present, there is another effect that allows the word to be "folded to the next line" without going beyond the range of the DIV block to the right , nor leaving too much The whitespace is at the end of the string, and all major browsers support the word-wrap property of CSS3 .
CSS3 word-wrap property syntax
Available values of the CSS3 word-wrap property
Set value | Description |
normal | By default, the browser usually presets the word to wrap before the blank space here, and keep the complete word. |
break-word | Words that are too long will automatically be folded to the next line. |
initial | Set the word wrapping style to the default value. |
inherit | The word-wrap style setting inherited from the parent layer is not supported by all browsers and is not recommended. |
<style>
#DIV1{
width:260px;
height:80px;
border:1px gray solid;
word-wrap:normal;
}
</style>
<div id="DIV1">
vckwefkosrmgsirjisfjknfsjfcfnsrficvmkse .mv.ksmvksmenrf.
</div>
CSS3 word-wrap property example 2: use break-word effect
<style>
#DIV2{
width:260px;
height:80px;
border:1px gray solid;
word-wrap:break-word;
}
</style>
<div id="DIV2" >
vckwefkosrmgsirjisfjknfsjfcfnsrficvmkse.mv.ksmvksmenrf.
</div>
Post a Comment
0 Comments