Chapter 6: Robot Style - Start
The beginning of the Robot Style project from Chapter 6 of JavaScript for Kids For Dummies by Chris Minnick and Eva Holland.
by rosakaufman
HTML
<div id="robot">https://jsfiddle.net/rosakaufman/z05bk2a1/#
<div id="head">
<div class="eye" id="righteye"></div>
<div class="eye" id="lefteye"></div>
<div id="nose"></div>
<div id="mouth"></div>
</div>
<div class="arm" id="rightarm"></div>
<div id="body">
<p>I <3 JS!</p>
</div>
<div class="arm" id="leftarm"></div>
</div>
CSS
body {
font-family: "Comic Sanz MS", cursive, sans-serif;
}
p {
font-size: 3.5em;
}
.eye {
background-color: #4a8c1b;
width: 30%;
height: 30%;
border-radius: 50%;
}
.arm {
background-color: #be2596;
position: absolute;
top: 35%;
left: 5%;
width: 8%;
height: 45%;
}
#head {
width: 30%;
height: 30%;
border-radius: 15%;
background-color: #e03ab4;
position: absolute;
left: 33%;
top: 5%;
}
#righteye {
position: absolute;
left: 10%;
top: 10%;
}
#lefteye {
position: absolute;
left: 60%;
top: 10%;
}
#nose {
position: absolute;
left: 40%;
top: 40%;
width: 20%;
height: 20%;
background-color: black;
}
#mouth {
position: absolute;
width: 65%;
height: 15%;
left: 20%;
top: 70%;
background-color: #ac38e6;
}
#body {
position: absolute;
left: 29%;
top: 35%;
width: 40%;
height: 55%;
background-color: #9925be;
text-align: center;
padding-top: 30px;
}
#rightarm {
position: absolute;
left: 20%;
}
#leftarm {
position: absolute;
left: 70%;
width: 25%;
height: 14%;
}
JavaScript
https://jsfiddle.net/rosakaufman/z05bk2a1/29/#