CSS3 知识量:11 - 43 - 138
text-shadow用于设置文本的阴影,其语法为:
text-shadow : color x-offset y-offset blur-radius;
以上参数简要说明如下:
color:阴影的颜色,可选项。不设置时,将使用文本的颜色。可以使用颜色关键字、十六进制颜色、RGB颜色、RGBA透明色等。该项可以放在第一,也可以放在最后。
x-offset:X轴位移量,用于指定阴影水平位移量。其值可正可负,正值时,阴影位于右边;负值时,阴影位于左边。
y-offset:Y轴位移量,用于指定阴影垂直位移量。其值可正可负,正值时,阴影位于底部;负值时,阴影位于顶部。
blur-radius:阴影模糊半径,表示阴影向外模糊的范围,可选性。值可以为正值或0。值越大,阴影向外模糊的范围越大,边缘越模糊。值为0时,表示没有模糊效果。
下面是文本阴影的应用示例:
<!DOCTYPE html> <html> <head> <title>文本阴影</title> <meta charset="UTF-8"> <style type="text/css"> h2{ text-shadow: red 10px 10px 5px; } div p{ width: 350px; padding: 10px; } div p:nth-of-type(1){ text-shadow: 10px -10px 2px; } div p:nth-of-type(2){ text-shadow: -10px -10px 2px; } div p:nth-of-type(3){ text-shadow: -10px 10px #0804ac; } </style> </head> <body> <h2>The Three Little Pigs</h2> <div> <p>Once upon a time there were three little pigs and the time came for them to leave home and seek their fortunes.</p> <p>Before they left, their mother told them " Whatever you do , do it the best that you can because that's the way to get along in the world.</p> <p>The first little pig built his house out of straw because it was the easiest thing to do.</p> </div> </body> </html>
显示的效果为:
Copyright © 2017-Now pnotes.cn. All Rights Reserved.
编程学习笔记 保留所有权利
MARK:3.0.0.20240214.P35
From 2017.2.6