One-eyed Android


#1

I just completed the Android CSS3 animated logo project in Web Dev 101. I got it working eventually, but my android only has one eye. Has anyone else experienced this quirk?

This is my HTML:

<!doctype html>
<html>

  <head>
    <title>Animated Android logo using CSS3</title>
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>

  <body>
  	<div class="android">
      <div class="head">
        <div class="l_ant"></div>
        <div class="r_ant"></div>
        <div class="l_eye"></div>
        <div class="r_eye"></div>
      </div>
      <div class="body">
        <div class="l_arm"></div>
        <div class="r_arm"></div>
        <div class="l_leg"></div>
        <div class="r_leg"></div>
      </div>
    </div>
  </body>
</html>

And here is my CSS:

div {
  margin: 0;
  padding: 0;
}

div div {
  background: #a4ca39;
  position: relative;
}

.android {
  height: 404px;
  width: 334px;
  margin: 100px auto;
}

.head {
  width: 220px;
  height: 100px;
  top: 32px;
  border-radius: 110px 110px 0 0;
  transition: all 0.1s ease-in;
}

.l_eye, .r_eye {
  background: #fff;
  width: 20px;
  height: 20px;
  top: 42px; 
  border-radius: 10px;
}

.l_eye {
  left: 50px;
}

.r_eye {
  right: 50px;
}

.l_ant, .r_ant {
  width: 6px;
  height: 50px;
  position: absolute;
  top: -34px;  
  border-radius: 3px;
}

.l_ant {
  left: 50px;
  transform: rotate(-30deg);
}

.r_ant {
  right: 50px;
  transform: rotate(30deg);
}

.body {
  width: 220px;
  height: 184px;
  top: 40px;
  border-radius: 0 0 25px 25px;
}

.l_arm, .r_arm, .l_leg, .r_leg {
  width: 50px;
  position: absolute;
  transition: all 0.1s ease-in;
}

.l_arm, .r_arm {
  height: 150px;
  border-radius: 25px;
}

.l_leg, .r_leg {
  height: 80px;
  top: 182px;
  border-radius: 0 0 25px 25px;
}

.l_arm {
  left: -58px;
}

.r_arm {
  right: -58px;
}

.l_leg {
  left: 45px;
}

.r_leg {
  right: 45px;
}

.head:hover {
  transform: rotate(-5deg) translate(-4px, -8px);
}

.l_arm:hover {
  transform: rotate(15deg) translate(-14px, 0);
}

.r_arm:hover {
  transform: rotate(-30deg) translate(30px, 0);
}

#2

I’m not sure where you went wrong following the video, but adding this to your right eye fixes it

.r_eye {
  left: 150px;
  top: 23px;
}

Your eye was waaay off screen to the left, check out your dev tools


#3

Thanks a lot.

I compared my code to the video’s again after checking your solution. My right eye was right. I left out another line.

I left out position: absolute from the following section:

.l_eye, .r_eye {
  background: #fff;
  width: 20px;
  height: 20px;
  top: 42px;
  position: absolute; /*This line was missing, along with the other eye*/
  border-radius: 10px;
}

#4

There you go! Sometimes it only takes a little thing to change a lot