css实现信封墙拆信封效果代码
代码语言:html
所属分类:布局界面
代码描述:css实现信封墙拆信封效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@charset "UTF-8";
* {
margin: 0;
padding: 0;
box-sizing: border-box;
position: relative;
}
*::before,
*::after {
content: "";
display: block;
position: absolute;
}
h1 {
font-size: 1.25rem;
text-align: center;
padding: 6vh;
font-family: 'Poppins', sans-serif;
font-weight: 500;
}
body {
background: #f3e0d4;
}
body .wrapper {
width: 100%;
margin: auto;
padding: 8%;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
grid-auto-rows: 3rem;
grid-row-gap: 3rem;
}
.envelope {
list-style: none;
width: 6rem;
height: 4rem;
background: blue;
}
.envelope::before {
width: 6rem;
height: 2.4rem;
top: 0;
left: 0;
transform-origin: 0% 0%;
transition: all 0.5s ease-out;
}
.card {
width: 5rem;
height: 1rem;
left: 0.5rem;
bottom: 3rem;
}
.card::after {
width: 3rem;
height: 1.6rem;
background: #fffefc;
bottom: 1rem;
left: 1rem;
transition: all 3s;
display: flex;
justify-content: center;
align-items: flex-start;
padding-top: 0.2em;
font-size: 1.25rem;
}
.card::before {
height: 0rem;
width: 6rem;
left: -0.5rem;
bottom: -2rem;
z-index: 2;
}
details[open] .envelope::before {
transform: rotateX(180deg);
}
details[open] .card::after {
animation: open 1.5s ease-in-out;
}
details[open] .card::before {
animation: disappear .8s ease-in-out;
}
details:nth-of-type(6n+1) .envelope {
background: linear-gradient(transparent 1%, #6a8e53 2%, transparent 5%), linear-gradient(-147deg, #769e5c 50%, transparent 40%) no-repeat 0 0/3rem 2rem, linear-gradient(147deg, #769e5c 50%, transparent 40%) no-repeat 3rem 0/3rem 2rem, linear-gradient(-33deg, #91b27b 67%, #769e5c 68% 69%, transparent 69%) no-repeat 0 2rem/3rem 4rem, linear-gradient(33deg, #91b27b 67%, #769e5c 68% 69%, transparent 69%) no-repeat 3rem 2rem/3rem 4rem, linear-gradient(-33deg, #91b27b 50%, transparent 52%), linear-gradient(33deg, #91b27b 50%, transparent 52%);
}
details:nth-of-type(6n+1) .envelope::before {
background: linear-gradient(33deg, transparent 50%, #769e5c 50%) 0 0/3rem 2.4rem, linear-gradient(-33deg, transparent 50%, #769e5c 50%) 3rem 0/3rem 2.4rem;
background-repeat: no-repeat;
}
details:nth-of-type(6n+1) .card {
background: linear-gradient(33deg, #91b27b 38%, transparent 39%), linear-gradient(-33deg, transparent 38%, #fffefc 39%);
}
details:nth-of-type(6n+1) .card::before {
background: linear-gradient(-33deg, #91b27b 67%, #769e5c 68% 69%, transparent 69%) no-repeat 0 2rem/3rem 4rem, linear-gradient(33deg, #91b27b 67%, #769e5c 68% 69%, transparent 69%) no-repeat 3rem 2rem/3rem 4rem, linear-gradient(-33deg, #91b27b 50%, transparent 52%), linear-gradient(33deg, #91b27b 50%, transparent 52%);
}
details:nth-of-type(6n+2) .envelope {
background: linear-gradient(transparent 1%, #016c82 2%, transparent 5%), linear-gradient(-147deg, #01819b 50%, transparent 40%) no-repeat 0 0/3rem 2rem, linear-gradient(147deg, #01819b 50%, transparent 40%) no-repeat 3rem 0/3rem 2rem, linear-gradient(-33deg, #01ABCE 67%, #01819b 68% 69%, transparent 69%) no-repeat 0 2rem/3rem 4rem, linear-gradient(33deg, #01ABCE 67%, #01819b 68% 69%, transparent 69%) no-repeat 3rem 2rem/3rem 4rem, linear-gradient(-33deg, #01ABCE 50%, transparent 52%), linear-gradient(33deg, #01ABCE 50%, transparent 52%);
}
details:nth-of-type(6n+2) .envelope::before {
background: linear-gradient(33deg, transparent 50%, #01819b 50%) 0 0/3rem 2.4rem, linear-gradient(-33deg, transparent 50%, #01819b 50%) 3rem 0/3rem 2.4rem;
background-repeat: no-repeat;
}
details:nth-of-type(6n+2) .card {
background: linear-gradient(33deg, #01ABCE 38%, transparent 39%), linear-gradient(-33deg, transparent 38%, #fffefc 39%);
}
details:nth-of-type(6n+2) .card::before {
background: linear-gradient(-33deg, #01ABCE 67%, #01819b 68% 69%, transparent 69%) no-repeat 0 2rem/3rem 4rem, linear-gradient(33deg, #01ABCE 67%, #01819b 68% 69%, transparent 69%) no-repeat 3rem 2rem/3rem 4rem, linear-gradient(-33deg, #01ABCE 50%, transparent 52%), linear-gradient(33deg, #01ABCE 50%, transparent 52%);
}
details:nth-of-type(6n+3) .envelope {
background: linear-gradient(transparent 1%, #bb9200 2%, transparent 5%), linear-gradient(-147deg, #d4a700 50%, transparent 40%) no-repeat 0 0/3rem 2rem, linear-gradient(147deg, #d4a700 50%, transparent 40%) no-repeat 3rem 0/3rem 2rem, linear-gradient(-33deg, #FFCA08 67%, #d4a700 68% 69%, transparent 69%) no-repeat 0 2rem/3rem 4rem, linear-gradient(33deg, #FFCA08 67%, #d4a700 68% 69%, transparent 69%) no-repeat 3rem 2rem/3rem 4rem, linear-gradient(-33deg, #FFCA08 50%, transparent 52%), linear-gradient(33deg, #FFCA08 50%, transparent 52%);
}
details:nth-of-type(6n+3) .envelope::before {
background: linear-gradient(33deg, transparent 50%, #d4a700 50%) 0 0/3rem 2.4rem, linear-gradient(-33deg, transparent 50%, #d4a700 50%) 3rem 0/3rem 2.4rem;
background-repeat: no-repeat;
}
details:nth-of-type(6n+3) .card {
background: linear-gradient(33deg, #FFCA08 38%, transparent 39%), linear-gradient(-33deg, transparent 38%, #fffefc 39%);
}
details:nth-of-type(6n+3) .card::before {
background: linear-gradient(-33deg, #FFCA08 67%, #d4a700 68% 69%, transparent 69%) no-repeat 0 2rem/3rem 4rem, linear-gradient(33deg, #FFCA08 67%, #d4a700 68% 69%, transparent 69%) no-repeat 3rem 2rem/3rem 4rem, linear-gradient(-33deg, #FFCA08 50%, transparent 52%), linear-gradient(33deg, #FFCA08 50%, transparent 52%);
}
details:nth-of-type(6n+4) .envelope {
background: linear-gradient(transparent 1%, #c16c07 2%, transparent 5%), linear-gradient(-147deg, #d97a08 50%, transparent 40%) no-repeat 0 0/3rem 2rem, linear-gradient(147deg, #d97a08 50%, transparent 40%) no-repeat 3rem 0/3rem 2rem, linear-gradient(-33deg, #F7941D 67%, #d97a08 68% 69%, transparent 69%) no-repeat 0 2rem/3rem 4rem, linear-gradient(33deg, #F7941D 67%, #d97a08 68% 69%, transparent 69%) no-repeat 3rem 2rem/3rem 4rem, linear-gradient(-33deg, #F7941D 50%, transparent 52%), linear-gradient(33deg, #F7941D 50%, transparent 52%);
}
details:nth-of-type(6n+4) .envelope::before {
background: linear-gradient(33deg, transparent 50%, #d97a08 50%) 0 0/3rem 2.4rem, linear-gradient(-33deg, transparent 50%, #d97a08 50%) 3rem 0/3rem 2.4rem;
background-repeat: no-repeat;
}
details:nth-of-type(6n+4) .card {
background: linear-gradient(33deg, #F7941D 38%, transparent 39%), linear-gradient(-33deg, transparent 38%, #fffefc 39%);
}
details:nth-of-type(6n+4) .card::before {
background: linear-gradient(-33deg, #F7941D 67%, #d97a08 68% 69%, transparent 69%) no-repeat 0 2rem/3rem 4rem, linear-gradient(33deg, #F7941D 67%, #d97a08 68% 69%, transparent 69%) no-repeat 3rem 2rem/3rem 4rem, linear-gradient(-33deg, #F7941D 50%, transparent 52%), linear-gradient(33deg, #F7941D 50%, transparent 52%);
}
details:nth-of-type(6n+5) .envelope {
background: linear-gradient(transparent 1%, #a1005f 2%, transparent 5%), linear-gradient(-147deg, #ba006e 50%, transparent 40%) no-repeat 0 0/3rem 2rem, linear-gradient(147deg, #ba006e 50%, transparent 40%) no-repeat 3rem 0/3rem 2rem, linear-gradient(-33deg, #ED008C 67%, #ba006e 68% 69%, transparent 69%) no-repeat 0 2rem/3rem 4rem, linear-gradient(33deg, #ED008C 67%, #ba006e 68% 69%, transparent 69%) no-repeat 3rem 2rem/3rem 4rem, linear-gradient(-33deg, #ED008C 50%, transparent 52%), linear-gradient(33deg, #ED008C 50%, transparent 52%);
}
details:nth-of-type(6n+5) .envelope::before {
background: linear-gradient(33deg, transparent 50%, #ba006e 50%) 0 0/3rem 2.4rem, linear-gradient(-33deg, transparent 50%, #ba006e 50%) 3rem 0/3rem 2.4rem;
background-repeat: no-repeat;
}
details:nth-of-type(6n+5) .card {
background: linear-gradient(33deg, #ED008C 38%, transparent 39%), linear-gradient(-33deg, transparent 38%, #fffefc 39%);
}
details:nth-of-type(6n+5) .card::before {
background: linear-gradient(-33deg, #ED008C 67%, #ba006e 68% 69%, transparent 69%) no-repeat 0 2rem/3rem 4rem, linear-gradient(33deg, #ED008C 67%, #ba006e 68% 69%, transparent 69%) no-repeat 3rem 2rem/3rem 4rem, linear-gradient(-33deg, #ED008C 50%, transparent 52%), linear-gradient(33deg, #ED008C 50%, transparent 52%);
}
details:nth-of-type(6n+6) .envelope {
background: linear-gradient(transparent 1%, #371c57 2%, transparent 5%), linear-gradient(-147deg, #43226a 50%, transparent 40%) no-repeat 0 0/3rem 2rem, linear-gradient(147deg, #43226a 50%, transparent 40%) no-repeat 3rem 0/3rem 2rem, linear-gradient(-33deg, #5C2E91 67%, #43226a 68% 69%, transparent 69%) no-repeat 0 2rem/3rem 4rem, linear-gradient(33deg, #5C2E91 67%, #43226a 68% 69%, transparent 69%) no-repeat 3rem 2rem/3rem 4rem, linear-gradient(-33deg, #5C2E91 50%, transparent 52%), linear-gradient(33deg, #5C2E91 50%, transparent 52%);
}
details:nth-of-type(6n+6) .envelope::before {
background: linear-gradient(33deg, transparent 50%, #43226a 50%) 0 0/3rem 2.4rem, linear-gradient(-33deg, transparent 50%, #43226a 50%) 3rem 0/3rem 2.4rem;
background-repeat: no-repeat;
}
details:nth-of-type(6n+6) .card {
background: linear-gradient(33deg, #5C2E91 38%, transparent 39%), linear-gradient(-33deg, transparent 38%, #fffefc 39%);
}
details:nth-of-type(6n+6) .card::before {
background: linear-gradient(-33deg, #5C2E91 67%, #43226a 68% 69%, transparent 69%) no-repeat 0 2rem/3rem 4rem, linear-gradient(33deg, #5C2E91 67%, #43226a 68% 69%, transparent 69%) no-repeat 3rem 2rem/3rem 4rem, linear-gradient(-33deg, #5C2E91 50%, transparent 52%), linear-gradient(33deg, #5C2E91 50%, transparent 52%);
}
details:nth-of-type(1) {
transform: rotate(41deg);
}
details:nth-of-type(1) .card::after {
content: "🤠";
}
details:nth-of-type(2) {
transform: rotate(7deg);
}
details:nth-of-type(2) .card::after {
content: "🤖";
}
details:nth-of-type(3) {
transform: rotate(9deg);
}
details:nth-of-type(3) .card::after {
content: "🎊";
}
details:nth-of-type(4) {
transform: rotate(8deg);
}
details:nth-of-type(4) .card::after {
content: "🥳";
}
details:nth-of-type(5) {
transform: rotate(-46deg);
}
details:nth-of-type(5) .card::after {
content: "🤠";
}
details:nth-of-type(6) {
transform: rotate(-56deg);
}
details:nth-of-type(6) .card::after {
content: "🤖";
}
details:nth-of-type(7) {
transform: rotate(8deg);
}
details:nth-of-type(7) .card::after {
content: "🐍";
}
details:nth-of-type(8) {
transform: rotate(-55deg);
}
details:nth-of-type(8) .card::after {
content: "🦄";
}
details:nth-of-type(9) {
transform: rotate(-26deg);
}
details:nth-of-type(9) .card::after {
content: "😺";
}
details:nth-of-type(10) {
transform: rotate(-51deg);
}
details:nth-of-type(10) .card::after {
content: "😈";
}
details:nth-of-type(11) {
transform: rotate(-26deg);
}
details:nth-of-type(11) .card::after {
content: "🤖";
}
details:nth-of-type(12) {
transform: rotate(9deg);
}
details:nth-of-type(12) .card::after {
content: "🎊";
}
details:nth-of-type(13) {
transform: rotate(45deg);
}
details:nth-of-type(13) .card::after {
content: "🦄";
}
details:nth-of-type(14) {
transform: rotate(-36deg);
}
details:nth-of-type(14) .card::after {
content: "🥳";
}
details:nth-of-type(15) {
transform: rotate(-21deg);
}
details:nth-of-type(15) .card::after {
content: "🐍";
}
details:nth-of-type(16) {
transform: rotate(-36deg);
}
details:nth-of-type(16) .card::after {
content: "😺";
}
details:nth-of-type(17) {
transform: rotate(-2deg);
}
details:nth-of-type(17) .card::after {
content: "🤖";
}
details:nth-of-type(18) {
transform: rotate(37deg);
}
details:nth-of-type(18) .card::after {
content: "🤖";
}
details:nth-of-type(19) {
transform: rotate(-3deg);
}
details:nth-of-type(19) .card::after {
content: "😈";
}
details:nth-of-type(20) {
transform: rotate(30deg);
}
details:nth-of-type(20) .card::after {
content: "🤖";
}
details:nth-of-type(21) {
transform: rotate(13deg);
}
details:nth-of-type(21) .card::after {
content: "🐍";
}
details:nth-of-type(22) {
transform: rotate(-42deg);
}
details:nth-of-type(22) .card::after {
content: "🐍";
}
details:nth-of-type(23) {
transform: rotate(-44deg);
}
details:nth-of-type(23) .card::after {
content: "🤖";
}
details:nth-of-type(24) {
transform: rotate(-9deg);
}
details:nth-of-type(24) .card::after {
content: "👻";
}
details:nth-of-type(25) {
transform: rotate(52deg);
}
details:nth-of-type(25) .card::af.........完整代码请登录后点击上方下载按钮下载查看
网友评论0