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. 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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 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.

HTML

              
                <div class="startScreen">
  <div class="rules rules1">
    <div class="rulesCont">
      <h1>Legit CSS only game for rural Americans</h1>
      <p>Try to kill the 30-50 feral hogs that run into your yard within 1 min while your small kids play</p>
      <div class="items">
        <div class="avoid">
          <h2>AVOID <span style="color: #b43939">-100 Points</span></h2>
          <div class="item avoid1">
            <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/756881/child.svg" alt="">
            <p>Don't shoot your kids.</p>
          </div>
        </div>

        <div class="collect">
          <h2>SHOOT <span style="color: #56b439">+2 Points</span></h2>
          <div class="item collect1">
            <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/756881/hog.svg" alt="">
            <p>Get those feral hogs!</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="endScreen">
  <div class="rules rules1">
    <div class="rulesCont">
      <h1>Assault weapons are still legal to purchase in the USA.</h1>
      <p>No one's a winner here.</p>
      <p> BBC News - <a href="https://www.bbc.co.uk/news/world-us-canada-41488081">America's gun culture in charts</a></p>
    </div>
  </div>
</div>

<div class="game">
  <div id="goodObjects">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
    <input type="checkbox" class="goodObject object">
  </div>

  <div id="badObjects">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
    <input type="checkbox" class="badObject object">
  </div>
  <h3 class="score"></h3>
  <div class="countdownBar"></div>
</div>
</div>
              
            
!

CSS

              
                // random decimal number

@function randomNum($min, $max) {
  $rand: random();
  $randomNum: $rand * ($max - $min) + $min;

  @return $randomNum;
}

@import url("https://use.typekit.net/ykf1xtx.css");

:root {
  $time: randomNum(180, 300) + s;
  --time: $time;
}
body {
  position: fixed;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  margin: 0;
  padding: 0;
  font-family: "sofia-pro", sans-serif;
  cursor: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/756881/Artboard%201.png"),auto;
  counter-reset: game;
}

a {
  color: #b13636;
}
.game {
  width: 100%;
  height: 100%;
  background-color: #77b190;
  z-index: 1;
}

.goodObject:checked {
  counter-increment: game 2;
}

.badObject:checked {
  counter-increment: game -100;
}

.score::after {
  content: counter(game);
  height: 40%;
  width: 100%;
  position: absolute;
  left: 0;
  top: 0;
  text-align: center;
}

#goodObjects input[type="checkbox"] {
  left: -180px;
  position: absolute;
  padding: 20px;
  margin: 20px;
  width: 150px;
  height: 112px;
  background-size: cover;
}

#badObjects input[type="checkbox"]{
  left: -180px;
  position: absolute;
  appearance: none;
  padding: 20px;
  margin: 20px;
  width: 139px;
  height: 135px;
  background-size: cover;
}

.goodObject {
  $hogs: random(20) + 30;
  @for $i from 1 through $hogs {
    $speed: randomNum(2, 7) + "s";
    $delay: randomNum(5, 40) + "s";
    $top: random(90) + "%";
    &:nth-child(#{$i}) {
      background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/756881/hogrun.svg")
        left center;
      top: #{$top};
      animation: falling #{$speed} infinite linear #{$delay}, run .5s steps(4) infinite;
    }
  }
}

.badObject {
  @for $i from 1 through 20 {
    $speed: randomNum(5, 11) + "s";
    $delay: randomNum(5, 40) + "s";
    $top: random(90) + "%";
     &:nth-child(#{$i}) {
      background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/756881/kidsrun.svg")
        left center;
      top: #{$top};
      animation: falling #{$speed} infinite linear #{$delay}, runkid .5s steps(4) infinite;
    }
  }
}

.score {
  position: relative;
  margin: 0;
  color: #f0fffb9c;
  font-size: 50vh;
  position: absolute;
  top: 10vh;
  width: 100%;
  height: 100%;
  left: 0;
  text-align: center;
  z-index: 2;
}

input[type="checkbox"] {
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
input[type="checkbox"]:focus {
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.goodObject:checked {
  pointer-events: none;
  animation-play-state: paused;
  background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/756881/ded.svg")!important;
}

.badObject:checked {
  pointer-events: none;
  background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/756881/dark.svg")!important;
  animation-play-state: paused;
}

@keyframes fade {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.goodObject,
.badObject {
  z-index: 3;
}

@keyframes falling {
  from {
    transform: translateX(-120px);
  }
  to {
    transform: translateX(150vw);
  }
}

.rules {
  opacity: 1;
  display: block;
  width: auto;
  height: auto;
  text-align: center;
  padding: 0px 50px 30px;
  background-color: #fff;
  -webkit-box-shadow: 2px 2px 1px 1px rgba(56, 58, 68, 0.466);
  box-shadow: 2px 2px 1px 1pxrgba(56, 58, 68, 0.466);
  border-radius: 6px;
  z-index: 9999;
  overflow-y: scroll;
  max-height: 90vh;
}

.rules h1 {
  text-align: center;
  font-weight: 900;
  font-family: "sofia-pro", sans-serif;
}

.rulesCont {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.items {
  position: relative;
  width: 100%;
  height: auto;
  margin-bottom: 30px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  justify-content: space-around;
}

.items img {
  width: 100px;
  height: 100px;
}

.item {
  width: 300px;
  height: auto;
  text-align: center;
}

.avoid,
.collect {
  position: relative;
  width: 40%;
  height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
}

.startScreen,
.endScreen {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background-color: #77b190;
}

.startScreen {
  opacity: 0;
  z-index: -9999;
  animation: fadeOut 6s linear;
}

.endScreen {
  opacity: 1;
  z-index: 9999;
  animation: fadeIn 60s linear;   
}

@keyframes fadeOut {
  0% {
    opacity: 1;
    z-index: 9999;
  }
  90% {
    opacity: 1;
    z-index: 9999;
  }
  98% {
    opacity: 0;
    z-index: 9999;
  }
  100% {
    z-index: -9999;
  }
}

@keyframes fadeIn {
  0% {
    opacity: 0;
    z-index: -9999;
  }
  97% {
    opacity: 0;
    z-index: -9999;
  }
  98% {
    opacity: 0;
    z-index: 9999;
  }
  99% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}

.countdownBar {
  position: absolute;
  width: 100%;
  top: 0;
  z-index: 5;
  background-color: #f0fffb9c;
  height: 50px;
}

.countdownBar:after {
  content: "";
  position: absolute;
  width: 0%;
  height: 100%;
  background-color: #446b44;
  left: 0;
  animation: countDown 60s 5s linear;
}

@keyframes countDown {
  0% {
    width: 0%;
  }
  85% {
    width: 85%;
    background-color: #388da0;
  }
  85.1% {
    width: 85.1%;
    background-color: #c56971;
  }
  100% {
    width: 100%;
    background-color: #c56971;
  }
}

@keyframes run {
  100% {
    background-position: -600px;
  }
}

@keyframes runkid {
    100% { background-position: -556px; }
}
              
            
!

JS

              
                // Nothing to see here folks!
              
            
!
999px

Console