GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||
GeezerVison is showing developer.mozilla.org — text-wrap CSS property - CSS | MDN
|
| Initial value | wrap |
|---|---|
| Applies to | text and block containers |
| Inherited | yes |
| Percentages | as each of the properties of the shorthand:
|
| Computed value | as each of the properties of the shorthand:
|
| Animation type | as each of the properties of the shorthand:
|
text-wrap =
<'text-wrap-mode'> ||
<'text-wrap-style'>
<text-wrap-mode> =
wrap |
nowrap
<text-wrap-style> =
auto |
balance |
stable |
pretty |
avoid-short-last-line
<h2 class="wrap" contenteditable="true">
The default behavior; the text in the heading wraps "normally"
</h2>
<h2 class="nowrap" contenteditable="true">
In this case the text in the heading doesn't wrap, and overflows the container
</h2>
<h2 class="balance" contenteditable="true">
In this case the text in the heading is nicely balanced across lines
</h2>
.wrap {
text-wrap: wrap;
}
.nowrap {
text-wrap: nowrap;
}
.balance {
text-wrap: balance;
}
h2 {
font-size: 2rem;
font-family: sans-serif;
}
The text in the example is editable. Change the text, adding long words, to view how the different line and word lengths impact wrapping.
| Specification |
|---|
| CSS Text Module Level 4 # text-wrap-shorthand |
white-spacewhite-space-collapsetext-wrap: balance on developer.chrome.com (2023)text-wrap: pretty on developer.chrome.com (2023)