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 class="badge">
  <div class="dotted">
    <div class="bubble" data-icon="!"></div>
  </div>
  <div class="tail">
    <div class="inner"></div>
  </div>
</div>
              
            
!

CSS

              
                @import compass

/* General Styles */
*, *:after, *:before
  box-sizing: border-box

html
  background: rgba(127, 127, 128, 1.0)

/* Mixins */
@mixin center-element-x
  left: 50%
  @include transform(translateX(-50%))
  
/* Variables */  
$circle-dimension: 100px
$circle-radius: 50%
$main-color: rgba(41,137,216, 1) // dark blue
$secondary-color: rgba(67, 143, 194, 1) // light blue
$terciary-color: rgba(255,255,255, 1) // white

/* Bagde Styles */
.badge
  position: relative
  height: 166px
  width: 100px
  margin: 100px auto
  //background: red
  
  .dotted
    @include center-element-x
    position: absolute
    z-index: 1
    width: $circle-dimension
    height: $circle-dimension
    border-radius: $circle-radius
    box-shadow: 0px 2px 10px 1px rgba(0,0,0,.5), inset 0px 0px 5px 1px rgba(0,0,0,.4)
    background: $terciary-color
    
    &:before, &:after
      @include center-element-x
      position: absolute
      border-radius: $circle-radius
      
    &:before
      content: ''
      z-index: 2
      top: 5px
      width: $circle-dimension - 10px
      height: $circle-dimension - 10px
      box-shadow: 0px 0px 2px 1px rgba(0,0,0,.8), inset 0px 0px 5px 1px rgba(0,0,0,.4)
      background: $main-color
      +filter-gradient(#7abcff, #4096ee, vertical)
      +background-image(linear-gradient(top,  lighten($main-color, 20%) 0%, lighten($main-color, 10%) 60%, $main-color 100%))
    
    &:after
      content: ''
      z-index: 3
      top: 10px
      width: $circle-dimension - 20px
      height: $circle-dimension - 20px
      border: 1px dashed $terciary-color
      font-size: 50px
      color: white
      text-align: center
      text-shadow: 0px 0px 4px lighten(black, 15%)
      padding:
        top: 8px
        right: 2px
  .bubble 
    @include center-element-x
    position: relative
    z-index: 4
    top: $circle-dimension - 75px
    width: 50px
    height: 50px
    padding: 0px
    background: $terciary-color
    border-radius: $circle-radius
    box-shadow: 0px 1px 2px 1px rgba(0,0,0,.4)
    
    &:before
      content: attr(data-icon)
      text-align: center
      font-size: 25px
      color: $main-color
      display: block
      padding:
        top: $circle-dimension - 89px
        right: 2px

      
    &:after
      content: ''
      display: block
      position: absolute
      bottom: -4px
      left: 5px
      width: 0
      border-style: solid
      border-width: 10px 4px 0
      border-color: #FFFFFF transparent
      z-index: 1
      transform: rotate(35deg)
    
  .tail
    @include center-element-x
    position: absolute
    z-index: 0
    top: $circle-dimension - 12px
    height: 70px
    width: 62px
    background: $main-color
    +filter-gradient(#2989d8, #2989d8, vertical)
    +background-image(linear-gradient(top,  lighten($main-color, 12%) 0%,lighten($main-color, 0%) 60%,$main-color 76%,lighten($main-color, 12%) 100%))
    box-shadow: 0px 3px 10px 1px rgba(0,0,0,.4)
    
    &:before, &:after
      content: ''
      position: absolute
      z-index: 0
      bottom: -15px
      width: 0px
      height: 0px
      border-style: solid
      
    &:before
      border-width: 15px 31px 0 0
      border-color: lighten($main-color, 12%) transparent transparent transparent
      
    &:after
      right: 0
      border-width: 0 31px 15px 0
      border-color: transparent lighten($main-color, 12%) transparent transparent
    
    .inner
      @include center-element-x
      position: absolute
      z-index: 1
      height: 75px
      width: 50px
      border:
        left: 1px dashed $terciary-color
        right: 1px dashed $terciary-color

    
              
            
!

JS

              
                /* 
  Series
    Name   : IMG to CSS
    Author : Eduardo Grigolo (@eduardoag)
    Date   : 22/MAY/2013
    Number : 1
    Version: 1.0a
  
  PSD (UI)
    Name  : Badge

  Description:
    This is an exercise to improve my CSS skills.
    I'll try to code one template a day based on the UI Designs from the site 365psd.com.
    My choices may not alwyas be the bet alternative, so if you plan to use this code in
    your project, please consider reviewing it before you do!

  !! All the rights are reserved to the author of the design. !!
      
*/
              
            
!
999px

Console