css实现图片靠墙阴影效果

代码语言:html

所属分类:布局界面

代码描述:css实现图片靠墙阴影效果

代码标签: 靠墙 阴影 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="apple-touch-icon" type="image/png" href="https://static.codepen.io/assets/favicon/apple-touch-icon-5ae1a0698dcc2402e9712f7d01ed509a57814f994c660df9f7a952f3060705ee.png" />
<meta name="apple-mobile-web-app-title" content="CodePen">
<link rel="shortcut icon" type="image/x-icon" href="https://static.codepen.io/assets/favicon/favicon-aec34940fbc1a6e787974dcd360f2c6b63348d4b1f4e06c77743096d55480f33.ico" />
<link rel="mask-icon" type="" href="https://static.codepen.io/assets/favicon/logo-pin-8f3771b1072e3c38bd662872f6b673a722f4b3ca2421637d5596661b4e2132cc.svg" color="#111" />
<title>CodePen - CSS leaning card effect</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<style>
.images-leaning {
  box-sizing: border-box;
  width: 100%;
  min-width: 800px;
  margin: 10em auto 0;
  min-height: 330px;
  position: relative;
  background-repeat: no-repeat;
  background-image: linear-gradient(352deg, transparent 45.2%, #bbb 45.5%, #bbb 45.6%, #ccc 45.8%, #eee 60%), linear-gradient(30deg, #ccc, #eee 90%);
  background-size: 100% 32.4em;
  background-position: 50% 100%;
}
.images-leaning > div {
  width: 250px;
  position: absolute;
  left: 50%;
  bottom: 7.8em;
  z-index: 0;
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: end;
          justify-content: flex-end;
}
.images-leaning > div:before {
  content: '';
  width: 60%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 7%;
  z-index: 1;
  background-repeat: no-repeat;
  background-image: linear-gradient(120deg, transparent 42%, rgba(0,0,0,0.15) 45%, rgba(0,0,0,0.35) 65%), linear-gradient(20deg, transparent 38%, rgba(0,0,0,0.25) 45%, rgba(0,0,0,0.23) 55%, rgba(0,0,0,0.13) 75%), radial-gradient(ellipse at 50% 100%, rgba(0,0,0,0.15) 3%, transparent 40%);
  -webkit-transform: rotate(-8deg);
          transform: rotate(-8deg);
}
.images-leaning > div:after {
  content: '';
  width: 60%;
  height: 100%;
  position: absolute;
  z-index: 3;
  background-image: linear-gradient(45deg, rgba(0,0,0,0.3), transparent 70%), linear-gradient(45deg, rgba(255,255,255,0) 60%, rgba(255,255,255,0.3) 80%);
  -webkit-transform: perspective(20em) rotateY(1deg) rotateZ(-5deg) skewY(-2deg) skewX(-1deg) scaleX(var(--resize));
          transform: perspective(20em) rotateY(1deg) rotateZ(-5deg) skewY(-2deg) skewX(-1deg) scaleX(var(--resize));
}
.images-leaning > div > img {
  width: 60%;
  height: 100%;
  display: block;
  position: relative;
  z-index: 2;
  border-left: 0.2em solid;
  -webkit-border-image: linear-gradient(105deg, transparent 0.5%, #aaa 0.7%) 1;
       -o-border-image: linear-gradient(105deg, transparent 0.5%, #aaa 0.7%) 1;
          border-image: linear-gradient(105deg, transparent 0.5%, #aaa 0.7%) 1;
  box-shadow: 0.1em 0.2em 0 -0.1em #666;
  -webkit-filter: saturate(90%);
          filter: saturate(90%);
  -webkit-transform: perspective(20em) rotateY(1deg) rotateZ(-5deg) skewY(-2deg) skewX(-1deg) scaleX(var(--resize));
          transform: perspective(20em) rotateY(1deg) rotateZ(-5deg) skewY(-2deg) skewX(-1deg) scaleX(var(--resize));
}
.images-leaning > div:nth-of-type(4) {
  --resize: 0.99;
  margin-left: -40.4em;
}
.images-leaning > div:nth-of-type(4):before {
  background-size:.........完整代码请登录后点击上方下载按钮下载查看

网友评论0