cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              label.label(for='checkbox') CSS Firefly </br> Checkbox Replacement
div.checkbox-wrap 
  input#checkbox.checkbox(type='checkbox')
  label.firefly(for='checkbox')
    div.abdomen
      div.thorax
        div.head
          div.eyes
          div.antennae
      div.wings
        div.wing.wing-a
        div.wing.wing-b
      

            
          
!
            
              $color-canvas: #1d1915;
$color-canvas: #0a2a43;
$color-glow: #fefa01;
$color-trim: #40341d;
$color-wing: #27231e;
$color-thorax: #d43b1f;
$color-shadow: #0e0a0a;
$color-text: #b8c5d0;

body{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  height:100vh;
  background:radial-gradient($color-canvas 30%, darken($color-canvas, 2%));
  font-family: 'Asap', sans-serif;
  &:after{
    content:'';
    display:block;
    position:absolute;
    top:1rem;
    right:1rem;
    bottom:1rem;
    left:1rem;
    border:4px solid darken($color-canvas, 5%);
    border-radius:2px;
    background:none;
    pointer-events:none;
  }
}

.label{
  flex:0;
  color:$color-text;
  letter-spacing:.04em;
  text-align:center;
  margin-bottom:2rem;
  font-size:3rem;
  @media screen and (min-width: 60rem){
    font-size:5vw;    
  }
}

.checkbox-wrap{
  flex:none;
  position:relative;
  width:10%;
  min-width:8rem;
  z-index:1;
  &:after{
    content:'';
    display:block;
    padding-top:50%;

  }
}

.checkbox{
  display:none;
}

.checkbox:checked ~ .firefly{
  .abdomen{
    background:$color-wing;
    box-shadow: inset 0 0 1.5rem rgba(150,0,0,.75);
    animation: flicker 4000ms ease infinite;
  }
  .wing-a{
    transform: rotate(30deg);
  }
  .wing-b{
    transform: rotate(-30deg);
  }  
}

.head{
  position:absolute;
  top:15%;
  left:60%;
  bottom:15%;
  background:$color-wing;
  width:70%;
  border-radius: 40% 80% 80% 40%;
  box-shadow: inset -.1rem 0 0 .3rem rgba($color-shadow, .2);
}

.eyes{
  position:absolute;
  top:-5%;
  right:10%;
  bottom:-5%;
  width:35%;
  &:before,&:after{
    content:'';
    display:block;
    position:absolute;
    right:0;
    width:100%;
    box-sizing:border-box;
    border-radius:100%;
    background: $color-shadow;
    padding-top:100%;
  }
  &:before{
    top:0;
  }
  &:after{
    bottom:0;
  }
}

.antennae{
  position:absolute;
  top:20%;
  left:-150%;
  bottom:20%;
  width:400%;
  z-index:-1;
  &:before,&:after{
    content:'';
    display:block;
    position:absolute;
    right:0;
    width:100%;
    box-sizing:border-box;
    border-color: $color-shadow;
    border-style:solid;
    padding-top:65%;
    border-width: .25rem .25rem .25rem 0;
  }
  &:before{
    top:80%;
    border-radius: 0 100% 100% 100% ;

  }
  &:after{
    bottom:80%;
    border-radius:100% 100% 100% 0;

  }
}


.thorax{
  position:absolute;
  top:0;
  left:100%;
  bottom:0;
  background:$color-thorax;
  width:30%; 
  border-radius: 20% 80% 80% 20%;
  box-shadow: inset -.1rem 0 .1rem .3rem rgba(0,0,0,.2);
}
.abdomen{
  position:absolute;
  top:10%;
  right:20%;
  bottom:10%;
  background:$color-wing;
  width:100%; 
  transition: all 1000ms ease;
  border-radius: 100% 30% 30% 100%;
  box-sizing:border-box;
  &:after{
    content:'';
    display:block;
    position:absolute;
    top:0;
    right:0;
    bottom:0;
    left:0;
    background:repeating-linear-gradient(90deg, 
      transparent 0, 
      transparent 15%,      
      rgba(0,0,20,.1) 15%, 
      rgba(0,0,20,.1) 20%

    );
    mix-blend-mode: multiply;
    border-radius: 100% 30% 30% 100%;
    z-index:0;
    box-shadow: inset -1rem 0 .2rem .3rem rgba(0,0,0,.1);

  }

}

.wings{
  position:absolute;
  top:-20%;
  right:0;
  bottom:-20%;
  left:-5%;
  z-index:1;

  .wing{
    position:absolute;
    right:0;
    background: repeating-linear-gradient(
      $color-wing 0%,
      $color-wing 40%,
      darken($color-wing,5%) 40%,
      darken($color-wing,5%) 60%
    );
    width:100%;
    height:50%;
    transition: all 200ms ease-out;
    border:1px solid $color-trim;
    box-sizing:border-box;
    box-shadow: inset .2rem 0 .1rem .5rem rgba(0,0,0,.5);

    &.wing-a{
      transform-origin:bottom right;
      top:0;
      border-radius: 90% 30% 0 20%;
    }
    &.wing-b{
      transform-origin:top right;
      top:50%;      
      border-radius: 20% 0 30% 90%;
    }

  }

}

@keyframes flicker{
  0%, 100%{
    background: $color-glow;
    box-shadow: 0 0 1rem $color-glow, inset -.25rem 0 0 .5rem rgba($color-shadow,.1);
  }
  30%, 70%{
    background: lighten($color-glow, 30%);    
    box-shadow: -1rem 0 8rem 1rem rgba($color-glow, 1), inset -.25rem 0 0 .5rem rgba($color-shadow,.1);
  }
  50%{    
    box-shadow: -1rem 0 8rem 1rem rgba($color-glow, .8), inset -.25rem 0 0 .5rem rgba($color-shadow,.1);
  }
}
            
          
!
999px
Loading ..................

Console