Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!--Thank you @akashbijwe for this super cute egg-->
<div class='head'>
</div>
<div class='container'>
  <div class='egg'>
    <div class='albumen'>
      <div class='yolk'>
        <div class='eyebrow1'>
          <div class='eyebrowinner'></div>
        </div>
        <div class='eyebrow2'>
          <div class='eyebrowinner'></div>
        </div>
        <div class='whiteLine'>
          <div class='whiteLineInner'></div>
        </div>
        <div class='eye eye1'></div>
        <div class='eye eye2'></div>
        <div class='mouth'></div>
      </div>
    </div>
</div>

              
            
!

CSS

              
                body{
  background-color: #FF9D47;
  padding: 0;
  margin: 0;
}
.container{
  height: 385px;
  width: 317px;
  position: absolute;
  margin: auto;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
.albumen{
  height: 300px;
  width: 300px;
  border: 10px solid #292826;
  background-color: #F5F5F5;
  border-radius: 50%;
  box-shadow: inset -14px -26px 0px #D1D1D1;
}
.yolk{
  background-color: #FFDD00;
  height: 140px;
  width: 140px;
  border: 10px solid #292826; 
  margin: auto;
  position: relative;
  top: 75px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: inset -6px -10px 0px rgba(0,0,0,.15); 
}

.yolk .eyebrow1{
  position: absolute;
  top: 30px;
  left: 14px;
  height: 20px;
  width: 32px;
  overflow: hidden;
  border-radius: 50%;
}

.yolk .eyebrow1 .eyebrowinner{
  border: 7px solid #292826;
  height: 50px;
  width: 55px;
  border-radius: 50%;
}

.yolk .eyebrow2{
  position: absolute;
  top: 29px;
  left: 90px;
  height: 20px;
  width: 32px;
  overflow: hidden;
  border-radius: 50%;
  direction: rtl;
}

.yolk .eyebrow2 .eyebrowinner{
  border: 7px solid #292826;
  height: 50px;
  width: 55px;
  border-radius: 50%;
}
.eye{
  background-color: #292826;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  position: absolute;
}
@keyframes eyeAnimate{
  0%{}
  15%{height: 30px; width: 30px;}
  50%{height: 25px; width: 25px;}
  85%{height: 25px; width: 25px;}
  100%{}
}
@keyframes eyeAnimate1{
  0%{}
  15%{height: 10px; width: 10px;}
  50%{height: 20px; width: 25px;}
  85%{height: 25px; width: 25px;}
  100%{}
}
.eye.eye1{
  top: 45px;
  left: 30px;
}

.eye.eye2{
  top: 45px;
  left: 85px;
}

.mouth{
  background-color: #292826;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  position: absolute; 
  top: 85px;
  left: 57px;
}
@keyframes mouthAnimate{
  0%{}
  15%{height: 50px; width: 50px;}
  50%{height: 45px; width: 45px;}
  85%{height: 50px; width: 50px;}
  100%{}
}
.whiteLine{
  position: absolute;
  top: 3px;
  left: 1px;
  height: 40px;
  width: 60px;
  overflow: hidden;
}
.whiteLine:after{
  content: '';
  position: absolute;
  top: 2px;
  right: 7px;
  background-color: #FFDD00;
  height: 12px;
  width: 10px;
  border-radius: 50%;
}

}
.whiteLine .whiteLineInner{
  border: 7px solid #F5F5F5;
  height: 127px;
  width: 127px;
  border-radius: 50%;
}
              
            
!

JS

              
                // For this project, you are going to declare various variables to
// animate and customize the egg on the webpage below.

// 1. Using the 'let' keyword, declare a new variable named 
// 'moufMovement'. Assign this variable to be true.

// You'll see that creating this variable and setting it to
// true animates the egg's mouth. 


// 2. Now animate the egg's eye by using the let keyword to 
// assign a new variable named myGoodEye to the string "itsAlive"
// You'll see that creating this variable animated the egg's eye. 

// 3. Animate the egg's other eye by using the let keyword to 
// assign a new variable named myOtherEye to the value 5
  

// 4. Using the let keyword, create a new array named colors that 
// has the following strings as elements : 
      // 1. "#FF9D47"
      // 2. "#4C24CC"
      // 3. "#60FF6A" 
      // 4. "#E80C3B"


//5. Change the background color by using the let keyword to assign
// a new variable named index to the value of 1.

// Change the value of index to 1, 2, and 4 and observe the change that occurs with each updated value




// The conditional statements below are covered in the next unit

if (moufMovement){
  let mouf = document.querySelector(".mouth");
  mouf.style.cssText = "animation: 4s mouthAnimate infinite;"
}

if (myGoodEye == "itsAlive"){
  let eyez = document.querySelector(".eye1");
  eyez.style.cssText = "animation: 4s eyeAnimate infinite;"
}

if (myOtherEye >= 5){
  let eyezs = document.querySelector(".eye2");
  eyezs.style.cssText = "animation: 3s eyeAnimate1 infinite;"
}

let backGround = document.querySelector("body");
backGround.style.backgroundColor = colors[index];
              
            
!
999px

Console