Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="canvas">
  <!-- pinky -->
  <div class="ghost pink">
    <div class="ghost-eyes">
      <div class="eye">
        <div class="eye-ball"></div>
      </div>      
      <div class="eye">
        <div class="eye-ball"></div>
      </div>
    </div>
    <ul class="ghost-bottom">
      <li class="arrow-down arrow-pink left">
      </li>
      <li class="arrow-down arrow-pink">
      </li>
       <li class="arrow-down arrow-pink">
      </li>
       <li class="arrow-down arrow-pink right">
      </li>    
    </ul>
  </div>
  <!-- inky -->
  <div class="ghost blue">
    <div class="ghost-eyes">
      <div class="eye">
        <div class="eye-ball"></div>
      </div>      
      <div class="eye">
        <div class="eye-ball"></div>
      </div>
    </div>
    <ul class="ghost-bottom">
      <li class="arrow-down arrow-blue left">
      </li>
      <li class="arrow-down arrow-blue">
      </li>
       <li class="arrow-down arrow-blue">
      </li>
       <li class="arrow-down arrow-blue right">
      </li>    
    </ul>
  </div>
  <!-- clyde -->
  <div class="ghost orange">
    <div class="ghost-eyes">
      <div class="eye">
        <div class="eye-ball"></div>
      </div>      
      <div class="eye">
        <div class="eye-ball"></div>
      </div>
    </div>
    <ul class="ghost-bottom">
      <li class="arrow-down arrow-orange left">
      </li>
      <li class="arrow-down arrow-orange">
      </li>
       <li class="arrow-down arrow-orange">
      </li>
       <li class="arrow-down arrow-orange right">
      </li>    
    </ul>
  </div>
  <!-- blinky -->
  <div class="ghost red">
    <div class="ghost-eyes">
      <div class="eye">
        <div class="eye-ball"></div>
      </div>      
      <div class="eye">
        <div class="eye-ball"></div>
      </div>
    </div>
    <ul class="ghost-bottom">
      <li class="arrow-down arrow-red left">
      </li>
      <li class="arrow-down arrow-red">
      </li>
       <li class="arrow-down arrow-red">
      </li>
       <li class="arrow-down arrow-red right">
      </li>    
    </ul>
  </div> 
<!--   <div class="power-pellets">
    <div class="pill"></div>
    <div class="pill"></div>
    <div class="pill"></div>
  </div> -->
  <!-- I'm Pac-Man -->
  <div class="pac-man">
    <div class="mouth">
    </div>
  </div>
</div>
            
          
!
            
              html,
body {
  background: #000;
}


.canvas {
  text-align: center;
  margin: 0 auto;
  padding-top: 100px;
}

.ghost {
  float: left;
  height: 130px;
  width: 120px;
  margin-left: 60px;
  margin-right: 25px;
  margin-bottom: 50px;
  border-radius: 90px 90px 0 0;
}

.pink {
  background: pink;
}

.blue {
  background: lightblue;
}

.orange {
  background: orange;
}

.red {
  background: red
}

.ghost-eyes {
  margin-top: 45px;
  margin-left: 5px;
}

.eye {
    width: 35px;
    height: 35px;
    overflow:hidden;
    float:left;
    margin-right: 5px;
    background:white;
    border-radius:50%;
}

.eye-ball {
      border-radius:50%;
      width:13px;
      height:13px;
      background: darkblue;
      margin-top: 10px;
      margin-left: 20px;
      transition-property:margin-left, margin-top;
      transition-duration:1.5s;
}

.ghost-bottom {
  float: left;
  margin-left: -40px;
  margin-top: 69px;
}

li {
  display: inline;
}

.arrow-down {
  width: 0; 
  height: 0; 
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;  
}

.arrow-pink {
    border-top: 20px solid pink;
}

.arrow-blue {
  border-top: 20px solid lightblue;  
}

.arrow-orange {
  border-top: 20px solid orange;  
}

.arrow-red {
  border-top: 20px solid red;  
}

.left {
    border-left: 0px solid ;
}

.right {
    border-right: 0px solid;  
}



.pill {
  float: left;
  height: 12px;
  width: 12px;
  margin: 65px 20px 0;
  background: white;
}

.pac-man {
  float: right;
  height: 150px;
  width: 150px;
  margin-right: 135px;
  background: yellow;
  border-radius: 100%;
}

.mouth {
  margin-top: 16px;
  margin-left: px;
  width: 0; 
  height: 0; 
  border-top: 60px solid transparent;
  border-bottom: 60px solid transparent;  
  border-left: 85px solid #000;
}


            
          
!
            
              const eyes = document.getElementsByClassName('eye-ball');
const pacMan = document.querySelector('.pac-man');
// this needs work lol

pacMan.addEventListener('click', function(){
 for (i = 0; i < eyes.length; i++ ) {
   const n = Math.floor(Math.random() * (20 - 0 + 1)) + 0;
   eyes[i].style.marginTop = n + 'px';
   eyes[i].style.marginLeft = n + 'px';
 }
})


            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console