CSSC3四:CSS3 文本效果

CSS3 文本效果

CSS3中包含几个新的文本特征。

在本章中您将了解以下文本属性:

  • text-shadow

  • word-wrap

CSS3的文本阴影

CSS3中,text-shadow属性适用于文本阴影。

Text shadow effect!

您指定了水平阴影,垂直阴影,模糊的距离,以及阴影的颜色:

h1
{
text-shadow: 5px 5px 5px #FF0000;
}

 

 

CSS3的换行

如果某个单词太长,不适合在一个区域内,它扩展到外面:

This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.

CSS3中,自动换行属性允许您强制文本换行 - 即使这意味着分裂它中间的一个字:

This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.

CSS代码如下:

允许长文本换行:

<html>
<head>
<style> 
p.test
{
width:11em; 
border:1px solid #000000;
word-wrap:break-word;
}
</style>
</head>
<body>
<p class="test"> This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.</p>
</body>
</html>

 

 

New Text Properties

属性描述CSS
hanging-punctuation 规定标点字符是否位于线框之外。 3
punctuation-trim 规定是否对标点字符进行修剪。 3
text-align-last 设置如何对齐最后一行或紧挨着强制换行符之前的行。 3
text-emphasis 向元素的文本应用重点标记以及重点标记的前景色。 3
text-justify 规定当 text-align 设置为 "justify" 时所使用的对齐方法。 3
text-outline 规定文本的轮廓。 3
text-overflow 规定当文本溢出包含元素时发生的事情。 3
text-shadow 向文本添加阴影。 3
text-wrap 规定文本的换行规则。 3
word-break 规定非中日韩文本的换行规则。 3
word-wrap 允许对长的不可分割的单词进行分割并换行到下一行。 3

 

posted on 2018-07-10 23:11  myworldworld  阅读(225)  评论(0)    收藏  举报

导航