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

              
                .monster
  .eye
    .eyeball
  .mouth
.monster.green
  .eye
    .eyeball
  .mouth
.pageLoading
  .monster
    .eye
      .eyeball
    .mouth
  .loading
    .bar
              
            
!

CSS

              
                $colorPink: #E1A679
$colorTea: #6C6024
$colorGreen: #7D6C46

@mixin size($w, $h:$w)
  width: $w
  height: $h
  
@mixin flexCenter
  display: flex
  justify-content: center
  align-items: center
  
html, body
  margin: 0
  padding: 0
  +size(100%)
  background-color: $colorPink
  +flexCenter
  font-family: "微軟正黑體"
  
.pageLoading
  position: fixed
  +size(100%)
  left: 0
  top: 0
  +flexCenter
  background-color: #BDC0BA
  flex-direction: column
  transition: opacity 0.5s 0.5s
  
  &.complete
    opacity: 0
    .monster
      transform: scale(0.01) rotate(360deg)
  
.monster
  +size(110px)
  background-color: $colorTea
  border-radius: 20px
  
  .eye
    +size(40%)
    border-radius: 50%
    +flexCenter
    background-color: #fff
    
  .eyeball
    +size(50%)
    border-radius: 50%
    background-color: $colorTea
    
  .mouth
    +size(32%, 12px)
    border-radius: 12px
    background-color: white
    margin-top: 15%
    
  cursor: pointer
  margin: 30px
  +flexCenter
  flex-direction: column
  
  &:before, &:after
    content: ""
    display: block
    +size(20%, 10px)
    background-color: #fff
    border-radius: 10px
    position: absolute
    left: 50%
    top: -10px
   
  &:before
    transform: translateX(-70%) rotate(45deg)
  &:after
    transform: translateX(-30%) rotate(-45deg)
  
  box-shadow: 0px 10px 20px rgba(black, 0.2)
  
  &,*
    transition: 0.5s
  
  &.green
    background-color: $colorGreen
    animation-delay: 0.5s
    .mouth, .eyeball
      background-color: $colorPink
      
  @keyframes jumping
    50%
      top: 0
      box-shadow: 0px 10px 20px rgba(black, 0.2)
    100%
      top: -50px
      box-shadow: 0px 120px 50px rgba(black, 0.2)
    
  @keyframes eyemove
    0%, 10%
      transform: translate(50%)
    90%, 100%
      transform: translate(-50%)
    
  position: relative
  animation: jumping 0.8s infinite alternate
  
  .eyeball
    animation: eyemove 1.6s infinite alternate
    
.loading
  +size(200px, 8px)
  margin-top: 80px
  border-radius: 5px
  background-color: #fff
  overflow: hidden
  transition: 0.5s
  
  .bar
    background-color: $colorTea
    +size(0%, 100%)
  

  
  
              
            
!

JS

              
                var percent = 0

var timer = setInterval(function() {
  $(".bar").css("width", percent+"%")
  percent += 1
  
  if (percent >= 100) {
    $(".pageLoading").addClass("complete")
    clearInterval(timer)
  }
}, 30)
              
            
!
999px

Console