Home >Web Front-end >CSS Tutorial >How to use CSS3 text-shadow font shadow

How to use CSS3 text-shadow font shadow

php中世界最好的语言
php中世界最好的语言Original
2017-11-24 09:27:302237browse

The

text-shadow style of CSS3 is to set the text shadow effect. This attribute originally existed in CSS2. The text shadow in CSS3 is applied again, so let’s do it Take a look at how text-shadow needs to be used.

CSS3 words:

text-shadow

Grammar structure

div{text-shadow:5px 2px 6px #000;}

Set the text shadow effect in the div box to start showing the shadow effect 5px from the left and 2px from the top. At the same time, the shadow size range is 6px and the shadow color is black (#000).

There are 4 values ​​for the text display shadow effect. The first value represents the distance from the left to start showing the shadow effect. The second value represents the distance from the left to start showing the shadow effect. The third value represents the size of the shadow range. , the fourth value is the shadow effect color.

Case HTML code

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>字体阴影 在线演示</title> 
<link href="images/style.css" rel="stylesheet" type="text/css" /> 
</head> 
<body> 
<div>我阴影文字</div> 
<div class="txt">文字阴影测试内容1</div> 
<div class="txt2">文字阴影测试内容2</div> 
</body> 
</html>

Corresponding CSS code:

.txt {text-shadow:5px 1px 6px #F93 }  
.txt2 {text-shadow:1px 1px 1px #000; padding:10px 0; color:#FFF; background:#CCC}

The above is how to use text-shadow in CSS3. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

How to hide the content of overflowing DIV

What are the techniques for CSS layout

How to set font style in CSS

The above is the detailed content of How to use CSS3 text-shadow font shadow. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn