1.溢出
<!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>
text-overflow, clip 剪断,ellipsis省略号。
div.test:hover {overflow: visible;
}
鼠标指向文字时显示剩余文字。
2,CSS Word Wrapping
The CSS word-wrap property allows long words to be able to be broken and wrap onto the next line.
<!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></body>
</html>
word-break的两种用法。
3.CSS Writing Mode
<!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>
test2是垂直显示的。