div+css实现天气预报卡片悬浮伸缩动画效果代码

代码语言:html

所属分类:悬停

代码描述:div+css实现天气预报卡片悬浮伸缩动画效果代码

代码标签: div css 天气 预报 卡片 悬浮 伸缩 动画

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

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

 
<link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Poppins:wght@400;700;900&amp;display=swap'>
<style>
    * {
  position: relative;
  font-family: "Poppins", sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #064C59;
}

.box {
  height: 70%;
  max-height: 300px;
  position: relative;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.5);
}
.box:hover .right {
  width: 500px;
}
.box:hover .templine {
  opacity: 1;
}
.box:hover .week {
  opacity: 1;
  top: 0;
}

.left, .right {
  display: inline-block;
  vertical-align: top;
  overflow: hidden;
}

.left {
  width: 250px;
  height: 300px;
  background-color: #fff;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
}
.left .text {
  margin: 30px;
  color: #064C59;
}
.left .area {
  margin-bottom: 5px;
  font-size: 16px;
  font-weight: 600;
}
.left .time {
  margin-bottom: 5px;
}
.left .detail {
  margin-bottom: 5px;
  font-size: 10px;
  opacity: 0.8;
}
.left .temp {
  margin-top: 40px;
  font-size: 60px;
  font-weight: 600;
}
.left .temp .small {
  font-size: 12px;
  position: absolute;
  top: 15px;
}
.left .cloud {
  width: 130px;
  Height: 50px;
  position: absolute;
  right: -30px;
  top: 160px;
  border-radius: 30px;
  background-color: #C9C9C9;
  box-shadow: 0px 0px 20px rgba(103, 103, 103, 0.3);
  animation: clouddrift 2s infinite;
}
.left .cloud:before, .left .cloud:after {
  content: "";
  background-color: #C9C9C9;
  display: block;
  width: 60px;
  Height: 60px;
  border-radius: 100%;
  position: absolute;
}
.left .cloud:before {
  left: 20px;
  top: -40px;
}
.left .cloud:after {
  left: 60px;
  top: -20px;
}

@keyframes clouddrift {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(10px);
  }
  1.........完整代码请登录后点击上方下载按钮下载查看

网友评论0