翘边阴影
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了翘边阴影相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
list-style: none;
}
.wrap{
width: 50%;
height: 200px;
margin: 50px auto;
}
h1{
font-size:40px;
text-align: center;
line-height: 200px;
}
.imgShadow{
background: rgba(255, 255, 255, 1);
position:relative;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
}
.imgShadow:after, .imgShadow:before{
position: absolute;
z-index: -1;
content: "";
top: 50%;
right: 10px;
bottom: 0;
left: 10px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
-webkit-box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
-moz-box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
border-radius: 100px/10px;
}
</style>
<style>
.box{
position: relative;
width: 320px;
height: 220px;
background: #fff;
clear: both;
margin: 100px auto;
border:1px solid #ccc;
box-shadow: 0 0 4px rgba(0, 0, 0, 0.3),0 0 40px rgba(0, 0, 0, 0.5) inset;
-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2),0 0 40px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2),0 0 40px rgba(0, 0, 0, 0.1) inset;
}
.box img{
width: 300px;
height: 200px;
margin: 10px;
display: block;
}
.box:after{
content: "";
position: absolute;
width: 90%;
height: 80%;
left: 5%;
bottom: 10%;
background: transparent;
z-index: -1;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
-webkit-box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
-moz-box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
-webkit-transform: skew(-16deg) rotate(-10deg);
}
.box:before{
content: "";
position: absolute;
width: 90%;
height: 80%;
left: 5%;
bottom: 10%;
background: transparent;
z-index: -1;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
-webkit-box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
-moz-box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
-webkit-transform: skew(16deg) rotate(10deg);
}
</style>
</head>
<body>
<div class="wrap imgShadow">
<h1>Hello World</h1>
</div>
<div class="box">
<img src="img.jpg" height="200" width="300" >
</div>
</body>
</html>
以上是关于翘边阴影的主要内容,如果未能解决你的问题,请参考以下文章