css布局实现卡通小恐龙效果

代码语言:html

所属分类:布局界面

代码描述:css布局实现卡通小恐龙效果

代码标签: 卡通 恐龙 效果

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


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

<style>
.general-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: flex-end;
}

.shadow {
  position: absolute;
  left: 20px;
  bottom: 10px;
  width: 120px;
  height: 30px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
}

.dragon1-container {
  margin: 20px;
  position: relative;
}

.horns {
  position: absolute;
  top: -30px;
  left: 40px;
}
.horns:before {
  content: '';
  display: block;
  height: 30px;
  width: 20px;
  background-color: #a8a4b0;
  border: 1px solid #000;
  border-top-left-radius: 10px 30px;
  border-top-right-radius: 10px 30px;
  transform: rotate(-30deg) translate(-35px, 10px);
}
.horns:after {
  content: '';
  display: block;
  height: 30px;
  width: 20px;
  background-color: #a8a4b0;
  border: 1px solid #000;
  border-top-left-radius: 10px 30px;
  border-top-right-radius: 10px 30px;
  transform: rotate(30deg) translate(20px, -17px);
}

.body {
  position: relative;
  width: 100px;
  height: 100px;
  background-color: #a8a4b0;
  border: 1px solid #000;
  border-top-left-radius: 50% 60%;
  border-top-right-radius: 50% 60%;
  border-bottom-left-radius: 50% 40%;
  border-bottom-right-radius: 50% 40%;
  box-shadow: inset -5px -7px rgba(126, 133, 158, 0.5);
}
.body:before {
  content: '';
  background-color: #a8a4b0;
  height: 30px;
  width: 20px;
  display: block;
  border: 1px solid #000;
  border-radius: 50%;
  border-width: 0 0 1px 0px;
  transform: translate(15px, 70px);
  z-index: 20;
  box-shadow: inset -2px -5px rgba(126, 133, 158, 0.5);
}
.body:after {
  content: '';
  background-color: #a8a4b0;
  height: 30px;
  width: 20px;
  display: block;
  border: 1px solid #000;
  border-radius: 50%;
  border-width: 0 0 1px 0px;
  transform: translate(65px, 40px);
  z-index: 20;
  box-shadow: inset -2px -5px rgba(126, 133, 158, 0.5);
}
.body:hover .belly:before, .body:hover .belly:after {
  background-color: pink;
}

.belly {
  position: absolute;
  bottom: 1px;
  left: 25px;
  height: 25px;
  width: 50px;
  background-color: #d1c5d1;
  border-radius: 50%;
  box-shadow: inset -2px -5px rgba(126, 133, 158, 0.3);
}
.belly:before {
  transition: background-color linear .5s;
  content: '';
  display: block;
  height: 10px;
  width: 15px;
  background-color: transparent;
  border-radius: 5px;
  transform: translate(-17px, -37px);
}
.belly:after {
  transition: background-color linear .5s;
  content: '';
  display: block;
  height: 10px;
  width: 15px;
  background-color: transparent;
  border-radius: 5px;
  transform: translate(53px, -47px);
}

.eye-R {
  background-color: #000;
  height: 10px;
  width: 10px;
  border-radius: 50%;
  position: absolute;
  top: 0px;
  animation: blink 2s linear infinite alternate;
}
.eye-R:after {
  display: block;
  content: '';
  background-color: #fff;
  height: 3px;
  width: 3px;
  border-radius: 50%;
  transform: translate(1px, 1px);
}

.eye-L {
  b.........完整代码请登录后点击上方下载按钮下载查看

网友评论0