文本阴影
text-shadow 属性
给文本内容添加阴影的效果。
文本阴影的语法格式如下:
text-shadow: x-offset y-offset blur color;
复制
• x-offset 是沿 x 轴方向的偏移距离,允许负值,必须参数。
• y-offset 是沿 y 轴方向的偏移距离,允许负值,必须参数。
• blur 是阴影的模糊程度,可选参数。
• color 是阴影的颜色,可选参数。
我们来举个例子吧!
新建一个 index4.html 文件,在其中写入以下内容。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> <style> div { font-size: 50px; color: rgb(0, 153, 255); text-shadow: 4px 4px 3px rgb(0, 255, 179); } </style> </head> <body> <div>示例内容</div> </body> </html>
复制