Home > Web Front-end > Front-end Q&A > How to add shadow in css3

How to add shadow in css3

WBOY
Release: 2022-01-24 10:43:33
Original
2884 people have browsed it

Method: 1. Use the "text-shadow: horizontal shadow vertical shadow blur distance color;" statement to add shadow to the text element; 2. Use "box-shadow: horizontal shadow vertical shadow blur distance blur distance color interior "Shadow;" statement adds a shadow to the box element.

How to add shadow in css3

The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.

How to add a shadow in css3

The text-shadow property sets a shadow to the text.

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

The syntax is:

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

How to add shadow in css3

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

How to add shadow in css3

The example is as follows:

<html>
<head>
<meta charset="utf-8"> 
<title>123</title> 
<style> 
div
{
width:300px;
height:100px;
background-color:yellow;
box-shadow: 10px 10px 5px #888888;
}
h1
{
text-shadow: 5px 5px 5px #FF0000;
}
</style>
</head>
<body>
<div>框阴影效果!</div>
<h1>文本阴影效果!</h1>
</body>
</html>
Copy after login

Output results :

How to add shadow in css3

(Learning video sharing: css video tutorial)

The above is the detailed content of How to add shadow in css3. 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