多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
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