How to add shadow effect to div with css

王林
Release: 2020-09-02 16:42:07
forward
4545 people have browsed it

How to add shadow effect to div with css

This article shares with you how to add shadows to divs with css. I hope it can help you.

(Related recommendations: CSS tutorial)

Code implementation:

<style type="text/css">
.mydiv{
   width:250px; 
   height:auto;
   border:#909090 1px solid;
   background:#fff;
   color:#333;
   filter:progid:DXImageTransform.Microsoft.Shadow(color=#909090,direction=120,strength=4);
   -moz-box-shadow: 2px 2px 10px #909090;
   -webkit-box-shadow: 2px 2px 10px #909090;
   box-shadow:2px 2px 10px #909090;
}
</style>
 
for IE:
direction 阴影角度 0°为从下往上 顺时针方向
strength  阴影段长度
 
-moz-box-shadow: 2px 2px 10px #909090;
-webkit-box-shadow: 2px 2px 10px #909090;
box-shadow:2px 2px 10px #909090;
 
第一个参数是x轴阴影段长度
第二个参数是y轴阴影段长度
第三个参数是往四周阴影段长度
第四个参数是阴影段颜色
 
div代码:
<div class="mydiv">
    123123213123
</div>
Copy after login

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

Related labels:
source:csdn.net
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