纯css实现卡片悬浮切换效果

代码语言:html

所属分类:选项卡

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<title> Awesome-css-card-hover-effect </title>
<style>
    body {
  background-color: red;
}

.page_title {
  text-align: center;
  color: whitesmoke;
  text-transform: uppercase;
  font-weight: 100;
  font-size: 50px;
}

.container {
  /* 	background:whitesmoke; */
  border-radius: 10pt;
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.box {
  position: relative;
  width: 370px;
  height: 270px;
  background: white;
  margin: 15px;
  box-sizing: border-box;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0px 0px 50px -15px;
  text-align: center;
  transition: 0.5s;
}

.box:hover {
  box-shadow: 0px 0px 100px -5px #000;
  /* 	border:2px double white; */
  transform: scale(1.1);
  transition: 1s;
}

.box .intro {
  box-sizing: border-box;
  text-align: center;
  font-size: 4rem;
  /* 	background-color:red; */
  /* 	background:linear-gradient(0deg,red,purple,cyan) no-repeat; */
  height: 100vh;
  position: absolute;
  width: 370px;
  height: 270px;
  padding-top: 80px;
  transition: all 0.5;
  background: url("C:\Users\#MachineNo15!\Pictures\logo m1.png");
}

.box .intro b {
  color: red;
  text-shadow: 0px 0px 3px red;
}

.box:hover .intro {
  transform: translatex(-370px);
  transition: all 1s;
}

.fa {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  font-size: 4rem;
  transition: 0.5s;
  text-align: center;
}

.box:hover ._fa {
  top: 15%;
  transition: 0.5s all;
}

.text {
  text-align: center;
  height: 100%;
  box-sizing: border-box;
  padding: 15px;
  position: absolute;
  top: 90px;
  font-size: 18px;
  font-weight: 100;
}

.title {
  position: relative;
  top: 30pt;
  color: red;
  font-size: 2rem;
}

.plane_a,
.plane_b,
.plane_c,
.plane_info {
  background: black;
  color: white;
  width: 15%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  transform: translatex(400px);
  animation: effect_out 1s ease-in-out;
}

/* style b */
.plane_a {
  background-color: cyan;
  z-index: 1;
}

.plane_b {
  animation-delay: 0.3s;
  background-color: black;
  z-index: 2;
}

.plane_c {
  animation-delay: 0.4s;
  background-color: red;
  z-index: 3;
}

.plane_info {
  z-index: 0;
}

.plane_info:hover {
  transition: 1s;
}

.planet .plane_info {
  background-image: url("http://www.nasa.gov/sites/default/files/kepler186f_artistconcept.jpg");
  background-repeat: no-repeat;
  background-size: cover;
}

.war .plane_info {
  background-image: url("https://cdn.vox-cdn.com/thumbor/DTpZqdjk9gjQXjfHg-nGvbVkYeY=/0x0:1920x1079/1200x800/filters:focal(807x387:1113x693)/cdn.vox-cdn.com/uploads/chorus_image/image/61911335/ss_7de403e6556a77f4f40c8aa5b62e970de3bc6304.1920x1080.0.jpg");
  background-repeat: no-repeat;
  background-size: cover;
  transition: 1s;
}

.nazi .plane_info {
  background-image: url("https://i.imgur.com/zBbIagw.jpg");
  background-repeat: no-repeat;
  background-size: cover;
}

.box:hover .style_b .plane_a,
.box:hover .style_b .plane_b,
.box:hover .style_b .plane_c {
  opacity: 0;
  animation: effect_in 0.9s ease-in-out;
}

.box:hover .style_b .plane_b {
  animation-delay: 0.3s;
  box-shadow: 10px 0px 20px 10px black;
}

.box:hover .style_b .plane_c {
  animation-delay: 0.4s;
  box-shadow: 10px 0px 20px 10px red;
}

.box:hover .style_b .plane_info {
  opacity: 0;
  box-shadow: 10px 0px 20px 10px black;
  animation: ef.........完整代码请登录后点击上方下载按钮下载查看

网友评论0