css3学习笔记之文本效果

本文介绍了CSS3中处理文本的一些高级技巧,包括如何使用text-shadow属性为文本添加阴影效果,以及如何利用word-wrap属性实现自动换行,避免文本超出显示区域。此外,还概述了CSS3中新引入的文本处理属性及其用途。

CSS3的文本阴影

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
< html >
< head >
< style >
h1
{
text-shadow: 5px 5px 5px #FF0000;
}
</ style >
</ head >
< body >
 
< h1 >Text-shadow effect!</ h1 >
 
< p >< b >Note:</ b > Internet Explorer 9 and earlier versions, does not support the text-shadow property.</ p >
 
</ body >
</ html >

CSS3的换行

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
< 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

转载于:https://www.cnblogs.com/aiyoubucuoo/p/5435412.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值