div+css实现小熊效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现小熊效果代码

代码标签: div css 小熊

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


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

<head>

  <meta charset="UTF-8">
  

<meta name="viewport" content="width=device-width, initial-scale=1">
  
  
  
<style>
article {
  --brown1: #a63;
  --brown2: #fb7;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80vmin;
  aspect-ratio: 1;
}

article * {
  position: absolute;
  box-sizing: border-box;
}

.shadow {
  width: 100%;
  height: 15%;
  border-radius: 50%;
  top: 90%;
  background: #0002;
}

.head {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.body {
  left: 50%;
  bottom: 0%;
  transform: translateX(-50%);
  width: 70%;
  height: 60%;
  border: 1vmin solid;
  border-radius:90% / 170% 170% 10% 10%;
  background: 
    radial-gradient(100% 150% at 50% 85%, var(--brown2) 25%, #0000 25.25%),
    var(--brown1);
}

.face {
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 60%;
  border: 1vmin solid;
  border-radius: 100% / 130% 130% 66% 65%;
  background: 
    radial-gradient(100% 80% at 50% 75%, var(--brown2) 25%, #0000 25.25%),
    var(--brown1);
}

.face::before,
.face::after {
  --pos: 18.75%;
  content: "";
  position: absolute;
  width: 8%;
  aspect-ratio: 1;
  background: var(--brown1);
  border-radius: 50%;
  top: 6%;
  right: var(--pos);
}

.face::after {
  left: 19%;
  top: 5%;
}

.nose {
  width: 30%;
  height: 20%;
  background: 
    radial-gradient(80% 50% at 35% 20%, white 20%, #0000 21%),
    black;
  border-radius: 100% / 50% 50% 120% 120%;
  top: 55%;
  left: 50%;
  transform: translate(-50%, 0);
}

.eye {
  --pos: 20%;
  width: 15%;
  aspect-ratio: 1;
  background: 
    radial-gradient(circle at 30% 30%, white 15%, #0000 16%),
    black;
  border-radius: 50%;
  top: 38%;
  right: var(--pos);
}

.eye + .eye {
  left: var(--pos);
}

.ear {
  --pos: 10%;
  width: 25%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1vmin solid;
  background: radial-gradient(var(--brown2) 40%, var(--brown1) 0);
  right: var(--pos);
  top: -5%;
}

.ear + .ear {
  left: var(--pos);
}

.foot {
  width: 30%;
  height: 30%;
  border: 1vmin solid;
  background: 
    radial-gradient(circle at 31% 20%, var(--brown2) 10%, #0000 0),
    radial-gradient(circle at 53% 25%, var(--brown2) 10%, #0000 0),
    radial-gradient(circle at 13% 30%, var(--brown2) 7%, #0000 0),
    radial-gradient(circle at 35% 60%, var(--brown2) 30%, #0000 0),
    v.........完整代码请登录后点击上方下载按钮下载查看

网友评论0