赞
踩
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset=utf-8 />
- <title>box-shadow</title>
- <link rel="stylesheet" href="css/shadow.css">
- </head>
- <body>
- <div class="wrap effect">
- <h3>Shadow Effect</h3>
- </div>
- <ul class="box">
- <li><img src="images/photo1.jpg"/></li>
- <li><img src="images/photo2.jpg"/></li>
- <li><img src="images/photo3.jpg"/></li>
- </ul>
- </body>
- </html>
- body {
- font-family: Arial;
- font-size: 23px;
- }
-
- .wrap h3 {
- text-align: center;
- position: relative;
- top: 80px;
- }
-
- .wrap {
- width: 70%;
- height: 200px;
- background: #FFF;
- margin: 40px auto;
- }
-
- .effect {
- position: relative;
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;/*inset内阴影*/
- }
-
- .effect:before, .effect:after {/*两个 阴影效果更好*/
- content: "";
- position: absolute;
- z-index: -1;
- box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
- top: 50%;/*top/bottom/left/right 相当于设置宽高*/
- bottom: 0;
- left: 10px;
- right: 10px;
- border-radius: 100px / 10px;/*水平半径100 垂直10*/
- }
-
- ul.box {
- width: 980px;
- height: auto;
- margin: 20px auto;
- padding: 0;
- clear: both;
- overflow: hidden;
- }
-
- ul.box li {
- list-style-type: none;
- margin: 20px 10px;
- padding: 0;
- width: 300px;
- height: 220px;
- border: 2px solid #efefef;
- position: relative;
- float: left;
- background: #ffffff;
- line-height: 220px;
- font-size: 32px;
- text-align: center;
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 60px rgba(0, 0, 0, 0.1) inset;
- }
-
- ul.box li:before {
- z-index: -2;
- position: absolute;
- background: transparent;
- width: 90%;
- height: 80%;
- content: '';
- left: 20px;
- bottom: 8px;
- transform: skew(-12deg) rotate(-4deg);/*skew图形转换(变形) 负值向左*/
- box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
- }
-
- ul.box li:after {
- z-index: -1;
- position: absolute;
- background: transparent;
- width: 90%;
- height: 80%;
- content: '';
- right: 20px;
- bottom: 8px;
- transform: skew(12deg) rotate(4deg);
- box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
- }
-
- .box li img {
- width: 290px;
- height: 210px;
- padding: 5px;
- }
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。