In CSS Text Effects we have following Properties:
text-overflow
word-wrap
word-break
writing-mode
Text-Overflow
The CSS text-overflow property specifies how overflowed content that is not displayed should be signaled to the user.
Code:
<!DOCTYPE html>
<html>
<head>
<style>
p.test1 {
white-space: nowrap;
width: 200px;
border: 1px solid #000000;
overflow: hidden;
text-overflow: clip;
}
p.test2 {
white-space: nowrap;
width: 200px;
border: 1px solid #000000;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
</head>
<body>
<h1>The text-overflow Property</h1>
<p>The following two paragraphs contains a long text that will not fit in the box.</p>
<h2>text-overflow: clip:</h2>
<p class="test1">This is some long text that will not fit in the box</p>
<h2>text-overflow: ellipsis(...):</h2>
<p class="test2">This is some long text that will not fit in the box</p>
</body>
</html>
Output:
![](https://static.wixstatic.com/media/0f65e1_1ea0f94507d44f92a2a72fe3801cb463~mv2.png/v1/fill/w_46,h_22,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/0f65e1_1ea0f94507d44f92a2a72fe3801cb463~mv2.png)
Word-Wrap
The CSS word-wrap property allows long words to be able to be broken and wrap onto the next line.
Code:
<!DOCTYPE html>
<html>
<head>
<style>
p.test {
width: 11em;
border: 1px solid #000000;
word-wrap: break-word;
}
p.test1{
width:11em;
border: 1px solid #000000;
}
</style>
</head>
<body>
<h1>The word-wrap Property</h1>
<h3> This with word-wrap property</h3>
<p class="test"> This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.</p>
<h3> This without word-wrap property </h3>
<p class="test1"> This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.</p>
</body>
</html>
Output:
![](https://static.wixstatic.com/media/0f65e1_f49b97b124904814850317aaa0dee696~mv2.png/v1/fill/w_45,h_27,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/0f65e1_f49b97b124904814850317aaa0dee696~mv2.png)
Word-Break
The CSS word-break property specifies line breaking rules.
Code:
<!DOCTYPE html>
<html>
<head>
<style>
p.test1 {
width: 140px;
border: 1px solid #000000;
word-break: keep-all;
}
p.test2 {
width: 140px;
border: 1px solid #000000;
word-break: break-all;
}
</style>
</head>
<body>
<h1>The word-break Property</h1>
<p class="test1">This paragraph contains some text. This line will-break-at-hyphens.</p>
<p class="test2">This paragraph contains some text. The lines will break at any character.</p>
<p><b>Note:</b> The word-break property is not supported in Opera 12 and earlier versions.</p>
</body>
</html>
Output:
![](https://static.wixstatic.com/media/0f65e1_3515b495bb5a4535a1538c59c9a98fa4~mv2.png/v1/fill/w_87,h_43,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/0f65e1_3515b495bb5a4535a1538c59c9a98fa4~mv2.png)
Writing-Mode
The CSS writing-mode property specifies whether lines of text are laid out horizontally or vertically.
Code:
<!DOCTYPE html>
<html>
<head>
<style>
p.test1 {
writing-mode: horizontal-tb;
}
span.test2 {
writing-mode: vertical-rl;
}
p.test2 {
writing-mode: vertical-rl;
}
</style>
</head>
<body>
<h1>The writing-mode Property</h1>
<p class="test1">Some text with default writing-mode.</p>
<p>Some text with a span element with a <span class="test2">vertical-rl</span> writing-mode.</p>
<p class="test2">Some text with writing-mode: vertical-rl.</p>
</body>
</html>
Output:
![](https://static.wixstatic.com/media/0f65e1_5411b74c246b4caeb750399b8f34d4f7~mv2.png/v1/fill/w_87,h_59,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/0f65e1_5411b74c246b4caeb750399b8f34d4f7~mv2.png)
Source: W3School
The Tech Platform