How to add shadow in css

藏色散人
Release: 2023-01-06 11:15:40
Original
3696 people have browsed it

How to add shadows in css: 1. Use the "box-shadow" attribute to add one or more shadows to the box; 2. Set a shadow to the text through the "text-shadow" attribute.

How to add shadow in css

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, DELL G3 computer

How to add shadow in css?

The box-shadow property adds one or more shadows to a box.

Tip: Please use border-image-* properties to construct beautiful scalable buttons!

Syntax

box-shadow: h-shadow v-shadow blur spread color inset;
Copy after login

Comments: box-shadow adds one or more shadows to the box. This property is a comma-separated list of shadows, each specified by 2-4 length values, an optional color value, and the optional inset keyword. The value for omitted length is 0.

How to add shadow in css

Code example:

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
width:300px;
height:100px;
background-color:#ff9900;
-moz-box-shadow: 10px 10px 5px #888888; /* 老的 Firefox */
box-shadow: 10px 10px 5px #888888;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
Copy after login

Effect:

How to add shadow in css

text-shadow attribute to Text set shadow.

Syntax

text-shadow: h-shadow v-shadow blur color;
Copy after login

Comments: The text-shadow property adds one or more shadows to text. This property is a comma-separated list of shades, each shade specified with two or three length values ​​and an optional color value. The omitted length is 0.

How to add shadow in css

Code example:

<!DOCTYPE html>
<html>
<head>
<style>
h1
{
text-shadow: 5px 5px 5px #FF0000;
}
</style>
</head>
<body>
<h1>文本阴影效果!</h1>
</body>
</html>
Copy after login

Effect:

How to add shadow in css

Recommendation: "HTML video tutorial》《css video tutorial

The above is the detailed content of How to add shadow in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template