Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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.

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

              
                <div class="sky">
  <div class="cloud"></div>
  <div class="cloud cloud--two"></div>
  <div class="cloud cloud--three"></div>
<!--   <h1>Bug Saves The World</h1> -->
</div>

<div class="lightning"></div>

<!-- Ladybug design inspired by "A Bugs Life" by AI Power on dribbble -->
<div class="ladybug">
  <div class="spot"></div>
  <div class="spot spot--two"></div>
  <div class="spot spot--three"></div>
  <div class="spot spot--four"></div>
  <div class="spot spot--five"></div>
  <div class="ladybug-face">
    <div class="ladybug-eye">
      <div class="pupil"></div>
    </div>
    <div class="ladybug-eye eye--two">
      <div class="pupil"></div>
    </div>
    <div class="mouth"></div>
  </div>
  <div class="ladybug-leg"></div>
  <div class="ladybug-leg ladybug-leg--two"></div>
  <div class="ladybug-leg ladybug-leg--three"></div>
  <div class="ladybug-leg ladybug-leg--four"></div>
  <div class="ladybug-leg ladybug-leg--five"></div>
  <div class="ladybug-leg ladybug-leg--six"></div>
</div>
<div class="antenna"></div>
<div class="antenna--end"></div>
<div class="antenna antenna--two"></div>
<div class="antenna--end antenna-end--two"></div>

<div class="light-background"></div>

<!-- Platforms for light background -->
<div class="platform-light-bg"></div>
<div class="platform-grass">
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
  <div class="platform-grass-triangle"></div>
</div>

<!-- todo: create realistic looking grass using a few gradients -->

<!-- todo -->
<!-- <div class="rain-drop"></div> -->

<div class="star"></div>
<div class="star gold"></div>

<!-- 110 / 70 -->


<!-- <div class="game-over"></div> -->
<div class="key">
  <div class="cover"></div>
  <div class="shaft"></div>
  <div class="key-teeth"></div>
  <div class="key-teeth lkt"></div>
</div>
              
            
!

CSS

              
                // Colors for tokens from https://randoma11y.com
@import url('https://fonts.googleapis.com/css2?family=Amatic+SC&family=Road+Rage&display=swap');

// greens (grass, maybe bug? etc)
$caribbean-green: #0ecfa6;
$inch-worm: #b8eb38;

// blues (sky, misc)
$midnight-blue-400: #121f63;
$midnight-blue-300: #1a4b67;
$blue-400: #2c6ae3;

// yellows
$green-yellow: #fafab5;
$star: #FFF376;

// reds
$ladybug: #E74C3C;
$ladybug-2: #CB4335;

// general
$white: #fff;
$grayed-white: #eee;
$gray: #aaa;
$black: #000;
$dark-100: #111;
$dark-200: #222;
$dark-300: #333;
$salmon: #FF8276;

body {
  line-height: 1.6;
  font-size: 16px;
  margin: 2rem auto;
  margin: 10rem;
}

.sky {
  $w: 50rem; /* 1rem = 16px , 800/16=50 */
  $h: 37.5rem; /* 1rem = 16px, 600/16=37.5 */
  background: linear-gradient(to bottom, $midnight-blue-400 10%, $midnight-blue-300 40% 45%, $midnight-blue-300 45% 50%);
  width: $w;
  height: $h;
}

.sky h1 {
  font-family: 'Road rage', sans-serif;
  margin-top: 3rem;
  text-align: center;
  position: relative;
  top: -60%;
  z-index: 999;
  font-size: 4rem;
  color: #000;
}

.cloud {
  $w: 180px;
  $h: 180px;
  position: relative;
  top: 75px;
  left: 65%;
  width: $w;
  height: $h;
  background: linear-gradient($white 20% 47.2%, $blue-400 50%, $white 50%, transparent 50%);
  border-radius: 50%;
  z-index: 99;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  width: 100px;
  height: 120px;
  top: 30px;
  border-radius: 50%;
  background: #eee;
  background: linear-gradient(#fff 50%, transparent 50%);
  background: linear-gradient($white 20% 46%, $blue-400 50%, $white 50%, transparent 50%);
}

.cloud::before {
  left: -22px;
}

.cloud::after {
  right: -22px;
}

.cloud--two {
  left: 33%;
  top: -15%;
  transform: scale(50%);
}

.cloud--three {
  left: 15%;
  top: -55%;
}

.cloud--four {
  left: 50%;
  top: -65%;
  transform: scale(70%);
}

.ladybug {
  $w: 250px;
  $h: 200px;
  position: relative;
  overflow: hidden;
  width: $w;
  height: $h;
  margin-left: 2rem;
  // margin-top: 10rem;
  border-top: 2px solid #000;
  border-radius: 50%;
  background: linear-gradient(to bottom, #F63B28 40%, $ladybug 44% 50%, transparent 50%);
  transform: scale(45%);
}

.spot {
  $s: 50px;
  position: relative;
  height: $s;
  width: $s;
  top: 2%;
  left: 6%;
  border-radius: 50%;
  background: $black;
}

.spot--two {
  left: 20%;
  top: -5%;
  width: 45px;
  height: 45px;
  transform: scale(50%);
}

.spot--three {
  left: 50%;
  top: -55%;
}

.spot--four {
  left: 70%;
  top: -45%;
  width: 35px;
  height: 35px;
}

.spot--five {
  left: 10%;
  top: -55%;
  width: 23px;
  height: 23px;
}

/* Right facing position */
.ladybug-face {
  width: 55px;
  height: 90px;
  border-radius: 50% 50% / 30% 10%;
  transform: rotate(90deg);
  background: #000;
  position: relative;
  top: -88%;
  left: 82%;
}

.ladybug-eye {
  position: relative;
  top: 71%;
  left: 20%;
  width: 18px;
  height: 20px;
  transform: rotate(90deg);
  border-radius: 50%;
  background: $white;
}

.eye--two {
  top: 26%;
}

.mouth {
  position: relative;
  top: 15%;
  left: 70%;
  width: 3px;
  height: 18px;
  top:-25%;
  left: 74%;
  background: $white;
}

.antenna {
  position: relative;
  top: -210px;
  top: -169px;
  left: 250px;
  left: 170px;
  z-index: 9999;
  width: 60px;
  width: 35px;
  height: 90px;
  border: 2px solid #000;
  border-color: #000 transparent transparent transparent;
  border-radius: 50% / 10% 10% 0 0;
  transform: rotate(290deg);
  top: -179px;
  left: 84px;
  transform: rotate(80deg);
}

.antenna--end {
  position: relative;
  top: -299px;
  top: -248px;
  left: 246px;
  left: 152px;
  top: -250px;
  left: 140px;
  width: 5px;
  width: 5px;
  height: 8px;
  height: 8px;
  border-radius: 50%;
  background: $dark-100;
}

.antenna--two {
  top: -310px;
  top: -268px;
  left: 273px;
  left: 188px;
  top: -273px;
  left: 185px;
  transform: rotate(290deg);
}

.antenna-end--two {
  left: 270px;
  left: 167px;
  top: -400px;
  top: -352px;
}

.ladybug-leg::after {
  content: "";
  position: absolute;
  top: 90%;
  width: 8px;
  height: 5px;
  border-radius: 30%;
  background: $black;
}


/* Left facing position */
.ladybug-face {
  width: 55px;
  height: 90px;
  height: 65px;
  border-radius: 50% 50% / 30% 10%;
  transform: rotate(90deg);
  background: #000;
  position: relative;
  top: -88%;
  top: -81.5%;
  left: -3%;
  left: 38%;
}
.ladybug-eye {
  position: relative;
  top: 11%;
  left: 23%;
  left: 21%;
  top: 18%;
  width: 18px;
  height: 20px;
  transform: rotate(90deg);
  border-radius: 50%;
  background: $white;
}

.pupil {
  position: relative;
  top: 45%;
  left: 40%;
  width: 3px;
  height: 3px;
  background: $black;
  border-radius: 50%;
}

// .eye--two {
//   top: 12%;
// }

// .mouth {
//   position: relative;
//   top: -20%;
//   left: 75%;
//   width: 3px;
//   height: 18px;
//   background: $white;
// }

.mouth::before,
.mouth::after {
  content: "";
  position: absolute;
  background: $salmon;
  width: 3px;
  height: 11px;
  opacity: .7;
  border-radius: 500px;
}

.mouth::before {
  top: 80%;
  left: -6px;
}

.mouth::after {
  top: -50%;
  left: -6px;
}

.ladybug-leg {
  position: absolute;
  top: 50%;
  left: 16%;
  background: $black;
  width: 4px;
  height: 23px;
  height: 16px;
  z-index: 999;
}

.ladybug-leg::before {
  content: "";
  position: absolute;
  top: 72%;
  left: -5px;
  left: 0;
  background: #000;
  border-radius: 2px;
  width: 4px;
  height: 16px;
  // transform: rotate(50deg);
}

.ladybug-leg::after {
  content: "";
  position: absolute;
  top: 135%;
  top: 142%;
  // right: -8%;
  left: -9.5px;
  left: -2px;
  width: 10px;
  height: 5px;
  border-radius: 30%;
  background: $black;
}

.ladybug-leg--two {
  left: 22%;
}

.ladybug-leg--three {
  left: 44%;
}

.ladybug-leg--four {
  left: 50%;
}

.ladybug-leg--five {
  left: 74%;
}

.ladybug-leg--six {
  left: 80%;
}

.light-background {
  width: 800px;
  height: 600px;
  background: $green-yellow;
}

// .antenna {
//   position: relative;
//   top: -210px;
//   left: -25px;
//   z-index: 9999;
//   width: 60px;
//   height: 90px;
//   border: 2px solid #000;
//   border-color: #000 transparent transparent transparent;
//   border-radius: 50% / 10% 10% 0 0;
//   // transform: rotate(70deg);
// }

// .antenna--end {
//   position: relative;
//   top: -299px;
//   left: 34px;
//   width: 8px;
//   height: 8px;
//   border-radius: 50%;
//   background: $dark-100;
// }

// .antenna--two {
//   top: -310px;
//   left: 1px;
// }

// .antenna-end--two {
//   left: 60px;
//   top: -400px;
// }

/* todo */
.rain-drop {
  width: 21px;
  height: 13px;
  width: 50px;
  height: 20px;
  margin: 2rem;
  background: $blue-400;
  background: repeating-linear-gradient(to right, $midnight-blue-400 40%, $midnight-blue-300 50%);
  border-radius: 50% 50% / 30% 10%;
}

.star {
  margin: 1rem;
  background: #000;
  width: 30px;
  height: 30px;
  clip-path: polygon(50% 0%, 61% 35%, 97% 47%, 68% 57%, 59% 64%, 50% 98%, 39% 64%, 32% 57%, 4% 47%, 39% 35%);
}

.gold {
  background: $star;
}

.platform-light-bg {
  background: $black;
  background: linear-gradient(to bottom, $caribbean-green 50%, #eee 50%);
  border-radius: 2px;
  width: 200px;
  height: 20px;
}

.platform-grass {
  position: relative;
  margin-top: 1rem;
  width: 300px;
  height: 100px;
  background: linear-gradient(to bottom, $caribbean-green 5% 15%, #906001 10% 15%, #9A6701 50%); // add one more dirt layer
  display: flex;
  align-items: center;
  margin: 1rem;
  overflow: hidden;
}

.platform-grass-triangle {
  position: relative;
  top: -32%;
  left: .5%;
  width: 50px;
  height: 16px;
  z-index: 999;
  background: $caribbean-green;
  transform: rotate(60deg);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  background: linear-gradient(180deg, $caribbean-green 80%, green 99%);
  // background: $caribbean-green;
}

.game-over {
  background: #000;
  width: 1080px;
  height: 640px;
}

.key {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #FFC300;
  background: #F4EA80;
  background: #FAEB53;
  border: 2px solid #000;
  position: relative;
  z-index: 999;
}

.cover {
  position: absolute;
  width: 30px;
  height: 30px;
  background: #fff;
  border-radius: 50%;
  border: 2px solid #000;
  top: 21%;
  left: 21%;
}

.shaft {
  width: 150px;
  height: 25px;
  background: #FAEB53;
  position: relative;
  left: 93%;
  top: 25%;
  z-index: -1;
  border: 2px solid #000;
  border-left: 0;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.key-teeth {
  width: 25px;
  height: 20px;
  border: 2px solid #000;
  position: relative;
  left: 225%;
  top: 25%;
  border-top: 0;
  background: #FAEB53;
  // border-radius: 10%;
  border-bottom-right-radius: 10px;
  border-bottom-left-radius: 10px;
}

.lkt {
  left: 287%;
  top: -12.5%;
}
              
            
!

JS

              
                // GitHub Game Off (Bug Theme) notes #1 - 11/10/21
// 1. Bug Saves The World
              
            
!
999px

Console