Help us understand the problem. What is going on with this article?

CSSでサルを作ってみた。

More than 3 years have passed since last update.

monkey.png

html
<div class="monkey">
  <div class="head">
    <div class="face"></div>
    <div class="eyes"></div>
    <div class="nose"></div>
    <div class="mouth"></div>
  </div>
  <div class="body">
    <div class="hand"></div>
    <div class="foot"></div>
  </div>
</div>

css
.monkey{
  position: relative;
  margin: 10px 0 0 25px;
}

.monkey .head{
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 100%;
  background: #856C40;
  z-index: 2;
  /* ギミック用 */
  transition: 3s;
}

/* ギミック */
.monkey .head:hover{
  transform: rotate(30deg);
}

.monkey .face{
  position: absolute;
  top: 30px;
  left: 50%;
  width: 90px;
  height: 50px;
  border-radius: 100%;
  background: #995762;
  transform: translateX(-50%);
  z-index: 2;
}

.monkey .face:after{
  position: absolute;
  top: 10px;
  left: 50%;
  content: "";
  display: inline-block;
  width: 70px;
  height: 80px;
  border-radius: 0 0 100% 100%;
  background: #995762;
  transform: translateX(-50%);
}

.monkey .eyes{
  position: absolute;
  top: 50px;
  left: 50%;
  z-index: 3;
}

.monkey .eyes:before,
.monkey .eyes:after{
  position: absolute;
  top: -10px;
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  border-radius: 100%;
  background: #000;
  box-shadow: 0 0 0 2px #BC9945 inset;
}

.monkey .eyes:before{
  left: -25px;
}

.monkey .eyes:after{
  right: -25px;
}

.monkey .nose{
  position: absolute;
  top: 45px;
  left: 50%;
  width: 5px;
  border: 10px solid transparent;
  border-bottom: 30px solid #987071;
  border-radius: 0 0 100% 100%;
  transform: translateX(-50%);
  z-index: 3;
}

.monkey .nose:before,
.monkey .nose:after{
  position: absolute;
  top: 27px;
  content: "";
  display: inline-block;
  width: 4px;
  height: 2px;
  background: #000;
}

.monkey .nose:before{
  transform: rotate(35deg);
  left: -3px;
}

.monkey .nose:after{
  transform: rotate(-35deg);
  right: -3px;
}

.monkey .mouth{
  position: absolute;
  top: 100px;
  left: 50%;
  width: 55px;
  height: 30px;
  border-radius: 0 0 100% 100%;
  background: #915762;
  transform: translateX(-50%);
  z-index: 1;
}

.monkey .body{
  position: absolute;
  top: 70px;
  left: -20px;
  width: 200px;
  height: 200px;
  border-radius: 100%;
  background: #856C40;
  z-index: 1;
}

.monkey .hand{
  position: absolute;
  width: 100%;
  top: 50%;
}

.monkey .hand:before,
.monkey .hand:after{
  position: absolute;
  top: -20px;
  content: "";
  display: inline-block;
  border-top: 3px solid transparent;
  border-right: 3px solid #614A2A;
  border-bottom: 3px solid #614A2A;
  border-left: 3px solid #614A2A;
  border-radius: 100%;
}

.monkey .hand:before{
  width: 35px;
  height: 70px;
  left: 45px;
  transform: rotate(-35deg);
}

.monkey .hand:after{
  width: 35px;
  height: 70px;
  right: 45px;
  transform: rotate(35deg);
}

.monkey .foot{
  position: absolute;
  top: 50%;
  left: 50%;
}

.monkey .foot:before,
.monkey .foot:after{
  position: absolute;
  top: -5px;
  content: "";
  display: inline-block;
  border: 3px solid #614A2A;
  border-radius: 100%;
  background: #856C40;
}

.monkey .foot:before{
  width: 55px;
  height: 120px;
  left: 20px;
  transform: rotate(50deg);
}

.monkey .foot:after{
  width: 55px;
  height: 120px;
  right: 20px;
  transform: rotate(-50deg);
}

transformのscaleを用いることで大きさを変える事ができます。

.monkey{
  transform: scale(1.0);
}

monkeys.png

左から scale(1.0) , scale(0.8) , scale(0.3)

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away