css实现卡片轮换图文折叠展开动画效果代码

代码语言:html

所属分类:幻灯片

代码描述:css实现卡片轮换图文折叠展开动画效果代码

代码标签: 轮换 图文 折叠 展开 动画 效果

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

<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  

  <link href="https://fonts.googleapis.com/css?family=Anton" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">


  
  
<style>
body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  background: #e4e2e5;
}
body #wrap {
  width: 800px;
  height: 500px;
  box-shadow: 0 20px 30px -5px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  position: relative;
  transform-style: preserve-3d;
  background: linear-gradient(to bottom, #fff 50%, #e4e2e5 50%);
}
body #wrap .trigger {
  position: absolute;
  width: 5%;
  height: 100%;
  bottom: 0;
  right: 0;
  z-index: 99;
  opacity: 1;
  cursor: pointer;
}
body #wrap .trigger:before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: #fff;
  box-shadow: -1px 0 0 0 rgba(0, 0, 0, 0.015);
  transition: 0.2s ease-in-out;
}
body #wrap .trigger:after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 20px 0 20px 20px;
  border-color: transparent transparent transparent #222;
  top: calc(50% - 20px);
  right: 8.5px;
  transition: 0.2s ease-in-out;
  opacity: 0;
}
body #wrap .trigger:first-of-type:checked ~ .innerwrap .cards .cardwrap:first-of-type {
  opacity: 0;
}
body #wrap .trigger:nth-of-type(8):checked ~ .innerwrap .cards .cardwrap:last-of-type {
  opacity: 0;
}
body #wrap .trigger:nth-of-type(1):after {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(1):hover:after {
  border-color: transparent transparent transparent #fff;
}
body #wrap .trigger:nth-of-type(1):hover:before {
  background: #222;
}
body #wrap .trigger:nth-of-type(1):checked {
  pointer-events: none;
  transform: translateX(100%);
}
body #wrap .trigger:nth-of-type(1):checked ~ .trigger {
  transform: translateX(0%);
  z-index: 98;
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cards {
  transform: rotate(0deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap input:nth-of-type(1) {
  transform: rotate(45deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap input:nth-of-type(2) {
  transform: rotate(90deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap input:nth-of-type(3) {
  transform: rotate(135deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap input:nth-of-type(4) {
  transform: rotate(180deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap input:nth-of-type(5) {
  transform: rotate(225deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap input:nth-of-type(6) {
  transform: rotate(270deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap input:nth-of-type(7) {
  transform: rotate(315deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap input:nth-of-type(8) {
  transform: rotate(360deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:nth-of-type(1) .card {
  transform: rotate(-45deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:nth-of-type(2) .card {
  transform: rotate(-90deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:nth-of-type(3) .card {
  transform: rotate(-135deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:nth-of-type(4) .card {
  transform: rotate(-180deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:nth-of-type(5) .card {
  transform: rotate(-225deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:nth-of-type(6) .card {
  transform: rotate(-270deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:nth-of-type(7) .card {
  transform: rotate(-315deg);
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(1):checked ~ .innerwrap .cardwrap:nth-of-type(8) .card {
  transform: rotate(-360deg);
}
body #wrap .trigger:first-of-type:checked ~ .innerwrap .cards .cardwrap:first-of-type {
  opacity: 0;
}
body #wrap .trigger:nth-of-type(8):checked ~ .innerwrap .cards .cardwrap:last-of-type {
  opacity: 0;
}
body #wrap .trigger:nth-of-type(2):after {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(2):hover:after {
  border-color: transparent transparent transparent #fff;
}
body #wrap .trigger:nth-of-type(2):hover:before {
  background: #222;
}
body #wrap .trigger:nth-of-type(2):checked {
  pointer-events: none;
  transform: translateX(200%);
}
body #wrap .trigger:nth-of-type(2):checked ~ .trigger {
  transform: translateX(0%);
  z-index: 97;
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cards {
  transform: rotate(45deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap input:nth-of-type(1) {
  transform: rotate(90deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap input:nth-of-type(2) {
  transform: rotate(135deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap input:nth-of-type(3) {
  transform: rotate(180deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap input:nth-of-type(4) {
  transform: rotate(225deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap input:nth-of-type(5) {
  transform: rotate(270deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap input:nth-of-type(6) {
  transform: rotate(315deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap input:nth-of-type(7) {
  transform: rotate(360deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap input:nth-of-type(8) {
  transform: rotate(405deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:nth-of-type(1) .card {
  transform: rotate(-90deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:nth-of-type(2) .card {
  transform: rotate(-135deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:nth-of-type(3) .card {
  transform: rotate(-180deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:nth-of-type(4) .card {
  transform: rotate(-225deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:nth-of-type(5) .card {
  transform: rotate(-270deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:nth-of-type(6) .card {
  transform: rotate(-315deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:nth-of-type(7) .card {
  transform: rotate(-360deg);
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(2):checked ~ .innerwrap .cardwrap:nth-of-type(8) .card {
  transform: rotate(-405deg);
}
body #wrap .trigger:first-of-type:checked ~ .innerwrap .cards .cardwrap:first-of-type {
  opacity: 0;
}
body #wrap .trigger:nth-of-type(8):checked ~ .innerwrap .cards .cardwrap:last-of-type {
  opacity: 0;
}
body #wrap .trigger:nth-of-type(3):after {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(3):hover:after {
  border-color: transparent transparent transparent #fff;
}
body #wrap .trigger:nth-of-type(3):hover:before {
  background: #222;
}
body #wrap .trigger:nth-of-type(3):checked {
  pointer-events: none;
  transform: translateX(300%);
}
body #wrap .trigger:nth-of-type(3):checked ~ .trigger {
  transform: translateX(0%);
  z-index: 96;
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cards {
  transform: rotate(90deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap input:nth-of-type(1) {
  transform: rotate(135deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap input:nth-of-type(2) {
  transform: rotate(180deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap input:nth-of-type(3) {
  transform: rotate(225deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap input:nth-of-type(4) {
  transform: rotate(270deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap input:nth-of-type(5) {
  transform: rotate(315deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap input:nth-of-type(6) {
  transform: rotate(360deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap input:nth-of-type(7) {
  transform: rotate(405deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap input:nth-of-type(8) {
  transform: rotate(450deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:nth-of-type(1) .card {
  transform: rotate(-135deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:nth-of-type(2) .card {
  transform: rotate(-180deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:nth-of-type(3) .card {
  transform: rotate(-225deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:nth-of-type(4) .card {
  transform: rotate(-270deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:nth-of-type(5) .card {
  transform: rotate(-315deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:nth-of-type(6) .card {
  transform: rotate(-360deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:nth-of-type(7) .card {
  transform: rotate(-405deg);
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(3):checked ~ .innerwrap .cardwrap:nth-of-type(8) .card {
  transform: rotate(-450deg);
}
body #wrap .trigger:first-of-type:checked ~ .innerwrap .cards .cardwrap:first-of-type {
  opacity: 0;
}
body #wrap .trigger:nth-of-type(8):checked ~ .innerwrap .cards .cardwrap:last-of-type {
  opacity: 0;
}
body #wrap .trigger:nth-of-type(4):after {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(4):hover:after {
  border-color: transparent transparent transparent #fff;
}
body #wrap .trigger:nth-of-type(4):hover:before {
  background: #222;
}
body #wrap .trigger:nth-of-type(4):checked {
  pointer-events: none;
  transform: translateX(400%);
}
body #wrap .trigger:nth-of-type(4):checked ~ .trigger {
  transform: translateX(0%);
  z-index: 95;
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cards {
  transform: rotate(135deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap input:nth-of-type(1) {
  transform: rotate(180deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap input:nth-of-type(2) {
  transform: rotate(225deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap input:nth-of-type(3) {
  transform: rotate(270deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap input:nth-of-type(4) {
  transform: rotate(315deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap input:nth-of-type(5) {
  transform: rotate(360deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap input:nth-of-type(6) {
  transform: rotate(405deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap input:nth-of-type(7) {
  transform: rotate(450deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap input:nth-of-type(8) {
  transform: rotate(495deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:nth-of-type(1) .card {
  transform: rotate(-180deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:nth-of-type(2) .card {
  transform: rotate(-225deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:nth-of-type(3) .card {
  transform: rotate(-270deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:nth-of-type(4) .card {
  transform: rotate(-315deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:nth-of-type(5) .card {
  transform: rotate(-360deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:nth-of-type(6) .card {
  transform: rotate(-405deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:nth-of-type(7) .card {
  transform: rotate(-450deg);
}
body #wrap .trigger:nth-of-type(4):checked ~ .innerwrap .cardwrap:last-of-type {
  opacity: 1;
}
body #wrap .trigger:nth-of-type(4):c.........完整代码请登录后点击上方下载按钮下载查看

网友评论0