CSS3 文本效果是這樣一個術語用來在正常的文本中實現一些額外的特性。
主要是兩個屬性的 CSS3 文本效果,如下:
* text-shadow
* word-wrap
**注意:**Internet Explorer 10, Firefox,Chrome, Safari, 和 Opera支持text-shadow 屬性。所有的主流瀏覽器支持自動換行(word-wrap)屬性。Internet Explorer 9及更早IE版本不支持 text-shadow 屬性
## text-shadow
文本陰影。 您指定了水平陰影,垂直陰影,模糊的距離,以及陰影的顏色:
~~~
.text-shadow {
text-shadow: 10px 10px 10px #6AAFCF;
}
~~~
## word-wrap
換行。 CSS3中,自動換行屬性允許您強制文本換行 - 即使這意味著分裂它中間的一個字:
~~~
.word-wrap {
word-wrap: break-word;
width: 150px;
border: 1px solid #ff0000;
}
~~~
## 屬性
| 屬性 | 描述 | CSS |
|------|-------|------|
| [hanging-punctuation](http://waylau.gitbooks.io/css3-tutorial/content/docs/Text%20Effect.html# "CSS3 hanging-punctuation 屬性") | 規定標點字符是否位于線框之外。 | 3 |
| [punctuation-trim](http://waylau.gitbooks.io/css3-tutorial/content/docs/Text%20Effect.html# "CSS3 punctuation-trim 屬性") | 規定是否對標點字符進行修剪。 | 3 |
| text-align-last | 設置如何對齊最后一行或緊挨著強制換行符之前的行。 | 3 |
| text-emphasis | 向元素的文本應用重點標記以及重點標記的前景色。 | 3 |
| [text-justify](http://waylau.gitbooks.io/css3-tutorial/content/docs/Text%20Effect.html# "CSS3 text-justify 屬性") | 規定當 text-align 設置為 "justify" 時所使用的對齊方法。 | 3 |
| [text-outline](http://waylau.gitbooks.io/css3-tutorial/content/docs/Text%20Effect.html# "CSS3 text-outline 屬性") | 規定文本的輪廓。 | 3 |
| [text-overflow](http://waylau.gitbooks.io/css3-tutorial/content/docs/Text%20Effect.html# "CSS3 text-overflow 屬性") | 規定當文本溢出包含元素時發生的事情。 | 3 |
| [text-shadow](http://waylau.gitbooks.io/css3-tutorial/content/docs/Text%20Effect.html# "CSS3 text-shadow 屬性") | 向文本添加陰影。 | 3 |
| [text-wrap](http://waylau.gitbooks.io/css3-tutorial/content/docs/Text%20Effect.html# "CSS3 text-wrap 屬性") | 規定文本的換行規則。 | 3 |
| [word-break](http://waylau.gitbooks.io/css3-tutorial/content/docs/Text%20Effect.html# "CSS3 word-break 屬性") | 規定非中日韓文本的換行規則。 | 3 |
| [word-wrap](http://waylau.gitbooks.io/css3-tutorial/content/docs/Text%20Effect.html# "CSS3 word-wrap 屬性") | 允許對長的不可分割的單詞進行分割并換行到下一行。 | 3 |
## 源碼
本文中所用例子源碼參見?[https://github.com/waylau/css3-tutorial](https://github.com/waylau/css3-tutorial)?中?`samples`?目錄下的 texteffects.html