CSS3包含幾個額外的特性,稍後將添加這些特性。
- text-overflow
- word-wrap
- word-break
CSS3中有以下最常用的屬性−
Sr.No. | Value & Description |
---|---|
1 | [B]Text-align-lastText-align-last 用於對齊文本的最後一行 |
2 | 文本強調 用於強調文本和顏色 |
3 | 文本溢出 用於確定如何向用戶發送未顯示的溢出內容的信號 |
4 | 斷字 用來斷線 |
5 | 自動換行 用來斷線和換行 |
Text-overflow
文本溢出屬性確定如何向用戶發送未顯示的溢出內容的信號。文本溢出的示例如下所示−
<html> <head> <style> p.text1 { white-space: nowrap; width: 500px; border: 1px solid #000000; overflow: hidden; text-overflow: clip; } p.text2 { white-space: nowrap; width: 500px; border: 1px solid #000000; overflow: hidden; text-overflow: ellipsis; } </style> </head> <body> <b>Original Text:</b> <p> Tutorials Point originated from the idea that there exists a class of readers who respond better to online content and prefer to learn new skills at their own pace from the comforts of their drawing rooms. </p> <b>Text overflow:clip:</b> <p class = "text1"> Tutorials Point originated from the idea that there exists a class of readers who respond better to online content and prefer to learn new skills at their own pace from the comforts of their drawing rooms. </p> <b>Text overflow:ellipsis</b> <p class = "text2"> Tutorials Point originated from the idea that there exists a class of readers who respond better to online content and prefer to learn new skills at their own pace from the comforts of their drawing rooms. </p> </body> </html>
它將產生以下結果&負;
CSS3 Word Breaking
用於斷行,下面的代碼顯示了斷字的示例代碼。
<html> <head> <style> p.text1 { width: 140px; border: 1px solid #000000; word-break: keep-all; } p.text2 { width: 140px; border: 1px solid #000000; word-break: break-all; } </style> </head> <body> <b>line break at hyphens:</b> <p class = "text1"> Tutorials Point originated from the idea that there exists a class of readers who respond better to online content and prefer to learn new skills at their own pace from the comforts of their drawing rooms. </p> <b>line break at any character</b> <p class = "text2"> Tutorials Point originated from the idea that there exists a class of readers who respond better to online content and prefer to learn new skills at their own pace from the comforts of their drawing rooms. </p> </body> </html>
它將產生以下結果&負;
CSS word wrapping
換行用於換行並換行到下一行;