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

              
                
<div id="header">ANIMATED WEATHER ICONS</div>
<div class="grid">  
   
    <div id="sunny_weather" class="grid__item">
      <div id="sun"></div>
    </div>
    <div id="sunny_cloudy_weather" class="grid__item">
      <div id="cloud" class="cloud_top cloud_regular"></div>
      <div id="sun"></div>
      <div id="cloud" class="cloud_bottom cloud_regular"></div>
    </div>
    <div id="cloudy_weather" class="grid__item">  
      <div id="cloud" class="cloud_right cloud_regular"></div>
      <div id="cloud" class="cloud_center cloud_regular"></div>
      <div id="cloud" class="cloud_left cloud_regular"></div>
    </div>
    <div id="rainy_weather" class="grid__item">
      <div id="cloud" class="cloud_right cloud_regular"></div>
      <div id="cloud" class="cloud_center cloud_regular"></div>
      <div id="rain" class="rain_regular"></div>
    </div>
    <div id="storm_weather" class="grid__item">
      <div id="cloud" class="cloud_right cloud_storm"></div>
      <div id="cloud" class="cloud_center cloud_storm"></div>
      <div id="rain" class="rain_storm"></div>
    </div>
    <div id="snowy_weather" class="grid__item">
      <div id="cloud" class="cloud_right cloud_regular"></div>
      <div id="cloud" class="cloud_center cloud_regular"></div>
      <div id="snow_flake" class="snow_flake_1">&#x2744;</div>
      <div id="snow_flake" class="snow_flake_2">&#x2744;</div>
      <div id="snow_flake" class="snow_flake_3">&#x2744;</div>
      <div id="snow_flake" class="snow_flake_4">&#x2744;</div>
    </div>
   
</div>
              
            
!

CSS

              
                
@import url('https://fonts.googleapis.com/css?family=Dosis:800');

/* VARIABLES */

$cloud_white: #E7E9EE;
$cloud_gray: #8fa0bc;
$cloud_black: #040D22;


/* MIXINS */

@mixin cloud-before-after($h, $w, $t, $l, $tl-rad, $tr-rad) {
  height: $h;
  width: $w;
  top: $t;
  left: $l;
  border-top-left-radius: $tl-rad;
  border-top-right-radius: $tr-rad;
}

@mixin cloud-position($t, $l) {
  top: $t;
  left: $l;
}

@mixin rain-storm-before-after($fs, $t, $l) {
  font-size: $fs;
  top: $t;
  left: $l;
}


/* HTML BODY GRID HEADER */

html, body {
  width: 100vw;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background: white;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
		grid-auto-rows: minmax(26vh, 190px);
  
}

.grid__item {
  background: white;
  padding: 1em;
  margin: 0;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack:center;
      -ms-flex-pack:center;
          justify-content:center;

} // .grid-item

#header {
  font-family: 'Dosis', sans-serif;
  font-size: 2em;
  color: $cloud-gray;
  text-align:center;
  line-height: 3;
}



/* SUN */

#sun {
  height: 100px;
  width: 100px;
  position: relative;
  background-image: -webkit-radial-gradient(75px 75px, circle cover, orange, yellow);
  border: 5px solid #f7f14c;
  border-radius: 50%;
  margin: 0 auto;
  
  &:before {
    content: '';
    height: 130px;
    width: 130px;
    position: absolute;
    top: -43px;
    left: -43px;
    background: transparent;
    opacity: 0;
    border: 30px solid #f7f14c;
    border-radius: 50%;
    -webkit-animation: pulse 3s ease-out;
    animation: pulse 3s ease-out;
    -webkit-animation-iteration-count: infinite;
    animation-iteration-count: infinite;
   }
  
} // #sun


/* CLOUDS */

#cloud {
  height: 40px;
  width: 120px;
  border-radius: 2em;
  position: relative;
  opacity: 0.9;
  -webkit-animation: clouds 2s;
  animation: clouds 2s;
  
  
  &:before, &:after {
    content: '';
    background: $cloud-gray;
    border-top: 0.15em solid $cloud-white;
    position: absolute;
    z-index: 0;
  }
  
  &:before {
    @include cloud-before-after(25px, 50px, -26px, 55px, 25px, 25px)
  }
  
  &:after {
    @include cloud-before-after(35px, 70px, -36px, 12px, 35px, 35px)
  }
  
}

.cloud_left {
  @include cloud-position(20%, -25%);
  -webkit-box-shadow:-30px 40px 20px 1px $cloud_gray;
          box-shadow:-30px 40px 20px 1px $cloud_gray;
}
.cloud_right {
  @include cloud-position(13%, 22%);
}

.cloud_center {
  @include cloud-position(0%, 0%);
}

.cloud_top {
  @include cloud-position(0%, 45%);
  z-index: 1;
}

.cloud_bottom {
  @include cloud-position(20%, -45%);
}

.cloud_regular {
  background: -webkit-linear-gradient(top, $cloud-gray 5%,  $cloud-white 100%);
}
.cloud_storm {
  background: -webkit-linear-gradient(top, $cloud-gray 5%,  $cloud-black 100%);
}


/* RAIN */

#rain {
  content:'';
  height: 70px;
  width: 90px;
  z-index: 0;
  left: -130px;
  top: 40px; 
  position: relative;
  -webkit-transform: skew(-20deg);
	   -moz-transform: skew(-20deg);
	     -o-transform: skew(-20deg);
  -webkit-animation: rain 3s, rainfall 3s infinite;
  animation: rain 3s, rainfall 3s infinite;
  -webkit-animation-delay: 0s, 4s;
          animation-delay: 0s, 4s;
  
}

.rain_regular {
  background: -webkit-linear-gradient(top, transparent 5%, #9CCAEE 100%);
}

.rain_storm {
  background: -webkit-linear-gradient(top, transparent 5%, #C0C0C0 100%);
  
  &:before,
  &:after {
    content:'\002301';
    width: 30px;
    height:30px;
    color: yellow;
    position: absolute;
    -webkit-transform: rotate(60deg);
       -moz-transform: rotate(90deg);
         -o-transform: rotate(90deg);
  }

  &:before {
    @include rain-storm-before-after (6em, -10%, 110%);
    -webkit-animation: lightning 2s linear infinite;
            animation: lightning 2s linear infinite;
}

  &:after {
    @include rain-storm-before-after (3em, 50%, 40%);
    -webkit-animation: lightning 1.5s linear infinite;
            animation: lightning 1.5s linear infinite;
  }
  
} // .rain_storm


/* SNOWFLAKES */

#snow_flake {
  content:'\002744';
  background: transparent;
  color: #C0C0C0;
  position: relative;
  top: 15%;
  left: -20%;
  opacity: 0; 
}

.snow_flake_1 {
  font-size: 1.5em;
  -webkit-animation: snowflake 3s linear infinite;
          animation: snowflake 3s linear infinite;
}

.snow_flake_2 {
  font-size: 2em;
  -webkit-animation: snowflake 3.5s linear infinite;
          animation: snowflake 3.5s linear infinite;
}

.snow_flake_3 {
  font-size: 2.5em;
  -webkit-animation: snowflake 4s linear infinite;
          animation: snowflake 4s linear infinite;
}

.snow_flake_4 {
  font-size: 2em;
  -webkit-animation: snowflake 4.5s linear infinite;
          animation: snowflake 4.5s linear infinite;
}


/* ANIMATIONS */

@-webkit-keyframes "pulse" {
  0% {-webkit-transform: scale(0); opacity: 0.0;}
  25% {-webkit-transform: scale(0); opacity: 0.0; }
  50% {-webkit-transform: scale(0.3); opacity: 0.0; }
  75% {-webkit-transform: scale(0.8); opacity: 0.5; }
  100% {-webkit-transform: scale(1); opacity: 0.0; }
}

@keyframes "pulse" {
  0% {-webkit-transform: scale(0); opacity: 0.0;}
  25% {-webkit-transform: scale(0); opacity: 0.0; }
  50% {-webkit-transform: scale(0.3); opacity: 0.0; }
  75% {-webkit-transform: scale(0.8); opacity: 0.5; }
  100% {-webkit-transform: scale(1); opacity: 0.0; }
}

@-webkit-keyframes clouds {
  0%   {opacity: 0.0; left:1px;}
  25%  {opacity: 0.25;}
  50%  {opacity: 0.5;}
  75%  {opacity: 0.75;}
  100% {opacity: 0.9;}
}

@keyframes clouds {
  0%   {opacity: 0.0; left:10%;}
  25%  {opacity: 0.25;}
  50%  {opacity: 0.5;}
  75%  {opacity: 0.75;}
  100% {opacity: 0.9;}
}

@-webkit-keyframes rain {
  0%   {opacity: 0.0;}
  25%  {opacity: 0.0;}
  50%  {opacity: 0.0;}
  75%  {opacity: 0.5;}
  100% {opacity: 0.9;}
}

@keyframes rain {
  0%   {opacity: 0.0;}
  25%  {opacity: 0.0;}
  50%  {opacity: 0.0;}
  75%  {opacity: 0.5;}
  100% {opacity: 0.9;}
}

@-webkit-keyframes rainfall {
  50%  {opacity: 0.5;}
  100% {opacity: 0.9;}
}

@keyframes rainfall {
  50%  {opacity: 0.5;}
  100% {opacity: 0.9;}
}

@-webkit-keyframes lightning {
  45%  {opacity: 0.0;}
  50%  {opacity: 1.0;}
  55%  {opacity: 0.5;}
  60%  {opacity: 0.0;}
}

@keyframes lightning {
  45%  {opacity: 0.0;}
  50%  {opacity: 1.0;}
  55%  {opacity: 0.5;}
  60%  {opacity: 0.0;}
}

@-webkit-keyframes snowflake {
  35%  {opacity: 0.0;}
  45%  {opacity: 0.5; top: 15%;  left: -30%;}
  55%  {opacity: 1.0; top: 18%;  left: -27%;}
  65%  {opacity: 1.0; top: 21%;  left: -24%;}
  75%  {opacity: 0.75; top: 24%;  left: -27%;}
  80%  {opacity: 0.25; top: 27%;  left: -30%;}
  90%  {opacity: 0.0; top: 30%;  left: -27%;}
}

@keyframes snowflake {
  35%  {opacity: 0.0;}
  45%  {opacity: 0.5; top: 15%;  left: -30%;}
  55%  {opacity: 1.0; top: 18%;  left: -27%;}
  65%  {opacity: 1.0; top: 21%;  left: -24%;}
  75%  {opacity: 0.75; top: 24%;  left: -27%;}
  80%  {opacity: 0.25; top: 27%;  left: -30%;}
  90%  {opacity: 0.0; top: 30%;  left: -27%;}
}
              
            
!

JS

              
                /*
TO-DO

Add flexbox for browser compatibility
*/
              
            
!
999px

Console