CSS 11 ๐ป line break and word break properties
line-break specifies how line break.
values: auto โ uses the default break rule
normal โ break using the most common rule
loose โ uses the least restrictive rule
strict โ uses the most stringent rule
anywhere โ no need for further explanation
example 1 โ this is the default value, and it allows line breaks between words or within a word
example 2 โ This allows line breaks between words or within a word
example 3 โ This allows line breaks at any point in the text block
word-break controls the behavior of line breaks
values: normal โ default, words break only at whitespace characters
break-all โ words break in any point of the text block
keep-all โ words break only at whitespace characters
break-word (deprecated)
example 1 โ this is the default value and it allows words to break at whitespace characters
example 2 โ This allows words to break at any point, even in the middle of a word (like "--" and "-")
example 3 โ this allows words to break only at whitespace characters, not in the middle of a word
11 – line-break and word-break properties
<p class="line-break-auto">This is a very long sentence without any specified line breaks. By default, the browser will break the word at spaces or punctuation marks to fit within the container width.</p class="line-break-auto">
<p class="line-break-normal">This is a very long sentence with irregular words and symbols like "--" and "-". By setting the `line-break: normal;` property, we can allow line breaks between words or within a word. However, it may not work as expected in all browsers.</p class="line-break-normal">
<p class="line-break-anywhere">This is a very long sentence without any spaces or punctuation marks and no line breaks are allowed. Setting `line-break: anywhere;` will allow line breaks at any point in the text block, but it may not work as expected in some browsers.</p class="line-break-anywhere">
<p class="word-break-normal">This is a very long sentence without any specified word breaks. By default, the browser will break the word at whitespace characters to fit within the container width.</p class="word-break-normal">
<p class="word-break-break-all">This is a very long sentence with irregular words and symbols like "--" and "-". By setting the `word-break: break-all;` property, we can force words to break at any point in the text block.</p class="word-break-break-all">
<p class="word-break-keep-all">This is a very long sentence without any spaces or punctuation marks and no word breaks are allowed. Setting `word-break: keep-all;` will prevent words from breaking in the middle of a word.</p class="word-break-keep-all">
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
}
.line-break-auto {
line-break: auto;
border: 1px solid #ddd;
margin-bottom: 20px;
}
.line-break-normal {
line-break: normal;
border: 1px solid #ddd;
margin-bottom: 20px;
}
.line-break-anywhere {
line-break: anywhere;
border: 1px solid #ddd;
margin-bottom: 20px;
}
.word-break-normal {
word-break: normal;
border: 1px solid #ddd;
margin-bottom: 20px;
}
.word-break-break-all {
word-break: break-all;
border: 1px solid #ddd;
margin-bottom: 20px;
}
.word-break-keep-all {
word-break: keep-all;
border: 1px solid #ddd;
margin-bottom: 20px;
}
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!