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="wrapper g-white headline">
  <h1>A bunch of badges</h1>
  <h4>(resize to adapt)</h4>
</div>

<div class="wrapper">
  <div class="card-wrapper">
    <div class="card g-salmon">
    <div class="header">
      <div class="dropdown control">
        <a href="#" class="dropdown-toggle"><i class="fa fa-cog"></i></a>
        <ul class="menu">
          <li><a class="dropdown-link" href="#"><i class="fa fa-wrench"></i> Configure</a></li>
          <li><a class="dropdown-link" href="#"><i class="fa fa-trash"></i> Remove</a></li>
        </ul>
      </div>
      <i class="fa fa-clock-o"></i>
      <h3 class="card-title">Hours</h3>
    </div>
    <div class="body">
      <h2>4h 30m (72.5%)</h2>
    </div>
  </div>
  </div>
  <div class="card-wrapper">
    <div class="card g-blue">
    <div class="header">
      <div class="dropdown control">
        <a href="#" class="dropdown-toggle"><i class="fa fa-cog"></i></a>
        <ul class="menu">
          <li><a class="dropdown-link" href="#"><i class="fa fa-wrench"></i> Configure</a></li>
          <li><a class="dropdown-link" href="#"><i class="fa fa-trash"></i> Remove</a></li>
        </ul>
      </div>
      <i class="fa fa-line-chart"></i>
      <h3 class="card-title">Productivity</h3>
    </div>
    <div class="body">
      <h2>80%</h2>
    </div>
  </div>
  </div>
  <div class="card-wrapper">
    <div class="card g-green">
    <div class="header">
      <div class="dropdown control">
        <a href="#" class="dropdown-toggle"><i class="fa fa-cog"></i></a>
        <ul class="menu">
          <li><a class="dropdown-link" href="#"><i class="fa fa-wrench"></i> Configure</a></li>
          <li><a class="dropdown-link" href="#"><i class="fa fa-trash"></i> Remove</a></li>
        </ul>
      </div>
      <i class="fa fa-map-signs"></i>
      <h3 class="card-title">Walking</h3>
    </div>
    <div class="body">
      <h2>2.3km</h2>
    </div>
  </div>
  </div>
  <div class="card-wrapper">
   <div class="card g-purple">
    <div class="header">
      <div class="dropdown control">
        <a href="#" class="dropdown-toggle"><i class="fa fa-cog"></i></a>
        <ul class="menu">
          <li><a class="dropdown-link" href="#"><i class="fa fa-wrench"></i> Configure</a></li>
          <li><a class="dropdown-link" href="#"><i class="fa fa-trash"></i> Remove</a></li>
        </ul>
      </div>
      <i class="fa fa-trophy"></i>
      <h3 class="card-title">Trophies</h3>
    </div>
    <div class="body">
      <h2>14</h2>
    </div>
  </div>
  </div>
</div>

<div class="wrapper">
  <div class="card-wrapper">
    <div class="card g-pink">
    <div class="header">
      <div class="dropdown control">
        <a href="#" class="dropdown-toggle"><i class="fa fa-cog"></i></a>
        <ul class="menu">
          <li><a class="dropdown-link" href="#"><i class="fa fa-wrench"></i> Configure</a></li>
          <li><a class="dropdown-link" href="#"><i class="fa fa-trash"></i> Remove</a></li>
        </ul>
      </div>
      <i class="fa fa-star"></i>
      <h3 class="card-title">Goals</h3>
    </div>
    <div class="body">
      <h2>3/5</h2>
    </div>
  </div>
  </div>
  <div class="card-wrapper">
    <div class="card g-dark-green">
    <div class="header">
      <div class="dropdown control">
        <a href="#" class="dropdown-toggle"><i class="fa fa-cog"></i></a>
        <ul class="menu">
          <li><a class="dropdown-link" href="#"><i class="fa fa-wrench"></i> Configure</a></li>
          <li><a class="dropdown-link" href="#"><i class="fa fa-trash"></i> Remove</a></li>
        </ul>
      </div>
      <i class="fa fa-map-signs"></i>
      <h3 class="card-title">Steps</h3>
    </div>
    <div class="body">
      <h2>6,245</h2>
    </div>
  </div>
  </div>
  <div class="card-wrapper">
    <div class="card g-purple alt">
    <div class="header">
      <div class="dropdown control">
        <a href="#" class="dropdown-toggle"><i class="fa fa-cog"></i></a>
        <ul class="menu">
          <li><a class="dropdown-link" href="#"><i class="fa fa-wrench"></i> Configure</a></li>
          <li><a class="dropdown-link" href="#"><i class="fa fa-trash"></i> Remove</a></li>
        </ul>
      </div>
      <i class="fa fa-calendar-o"></i>
      <h3 class="card-title">Meetings</h3>
    </div>
    <div class="body">
      <h2>25</h2>
    </div>
  </div>
  </div>
  <div class="card-wrapper">
    <div class="card g-turquoise">
    <div class="header">
      <div class="dropdown control">
        <a href="#" class="dropdown-toggle"><i class="fa fa-cog"></i></a>
        <ul class="menu">
          <li><a class="dropdown-link" href="#"><i class="fa fa-wrench"></i> Configure</a></li>
          <li><a class="dropdown-link" href="#"><i class="fa fa-trash"></i> Remove</a></li>
        </ul>
      </div>
      <i class="fa fa-heart"></i>
      <h3 class="card-title">Top Activity</h3>
    </div>
    <div class="body">
      <h2>Code</h2>
    </div>
  </div>
  </div>
</div>

<div class="wrapper bottom">
  <h4>Gradients based on <a href="https://webkul.github.io/coolhue/" targe="_blank">CoolHue</a></h4>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Roboto:300,400,700');

$white: #FFF;
$blue: #0396FF;
$grey: #EEE;
$grey-dark: #424242;

body{
  font-family: 'Roboto', sans-serif;
  margin: 0;
  padding: 0;
  background: url("https://www.toptal.com/designers/subtlepatterns/patterns/geometry.png");
  background-position: 0px 0px;
  animation: animateBg 20s linear infinite;
}


.wrapper{
  display: flex;
  width: 100%;
  max-width: 100vw;
  padding: 0;
  &.headline{
    background: transparent;
    padding: 15px 1%;
    display: block;
    > * {
      margin: 5px auto;
      font-weight: 300;
    }
  }
  &.bottom{
    background: $white;
    text-align: center;
    position: fixed;
    bottom: 0;
    padding: 5px 15px;
    > * {
      margin: 5px;
      width: 100%;
      font-weight: 300;
    }
    a{
      color: $blue;
    }
  }
}

.card-wrapper{
  width: 25%;
  margin: 15px 5px;
  min-height: 100px;
}

.card{
  display: block;
  padding: 5px 15px 25px;
  background: #FFF;
  border-radius: 4px;
  -webkit-box-shadow: 0px 3px 25px -5px rgba(0,0,0,0.5);
  -moz-box-shadow: 0px 3px 25px -5px rgba(0,0,0,0.5);
  box-shadow: 0px 3px 25px -5px rgba(0,0,0,0.5);
	transition: box-shadow .2s;
  
  .header{
    position: relative;
    .fa, .card-title{
      display: inline-block;
    }
    .control{
      color: $white;
      text-decoration: none;
      position: absolute;
      right: -5px;
      top: -15px;
      opacity: 0;
      transition: top .2s, opacity .2s;
    }
  }
  
  .card-title{
    font-weight: 300;
    text-transform: uppercase;
    margin-bottom: 5px;
  }
  
  .body{
    > * {
      margin: 0;
      text-align: right;
    }
  }

  //Card states
  &:hover{
    -webkit-box-shadow: 0px 2px 10px -4px rgba(0,0,0,0.5);
    -moz-box-shadow: 0px 2px 10px -4px rgba(0,0,0,0.5);
    box-shadow: 0px 2px 10px -4px rgba(0,0,0,0.5);
    transition: box-shadow .5s;
    
    .header{
      .control{
        top: 0px;
        opacity: 1;
        transition: top .2s, opacity .2s;
      }
    }
  }
  &:active, &:focus{
    -webkit-box-shadow: 0px 0px 10px -8px rgba(0,0,0,0.5);
    -moz-box-shadow: 0px 0px 10px -8px rgba(0,0,0,0.5);
    box-shadow: 0px 0px 10px -8px rgba(0,0,0,0.5);
    transition: box-shadow 1s;
  }
}

.dropdown{
  position: relative;
  z-index: 1000;
  .dropdown-toggle{
    text-decoration: none;
    color: $white;
    i{
      transform: rotate(0deg);
      transition: transform .4s;
    }
  }
  ul{
    display: none;
    background: $white;
    position: absolute;
    width: 150px;
    padding: 0;
    top: 5px;
    right: 0;
    border-radius: 4px;
    -webkit-box-shadow: 0px 3px 25px -5px rgba(0,0,0,0.5);
    -moz-box-shadow: 0px 3px 25px -5px rgba(0,0,0,0.5);
    box-shadow: 0px 3px 25px -5px rgba(0,0,0,0.5);
    li{
      list-style-type: none;
      a{
        display: block;
        text-decoration: none;
        padding: 10px 15px;
        background: $white;
        color: $grey-dark;
        transition: background .5s, color .5s;
        &:first-child{
          border-top-left-radius: 4px;
          border-top-right-radius: 4px;
        }
        &:last-child{
          border-bottom-left-radius: 4px;
          border-bottom-right-radius: 4px;
        }
        &:hover{
          background: $grey;
          color: $blue;
          transition: background .6s, color .6s;
          &:first-child{
            border-top-left-radius: 4px;
            border-top-right-radius: 4px;
          }
          &:last-child{
            border-bottom-left-radius: 4px;
            border-bottom-right-radius: 4px;
          }
        }
      }
    }
  }
  &.open{
    .dropdown-toggle{
      i{
        transform: rotate(145deg);
        transition: transform .4s;
      }
    }
    ul{
      display: block;
    }
  }
}

//Media
@media(max-width: 768px){
  .wrapper{
    display: inline-block;
  }
  .card-wrapper{
    margin: 15px 1%;
    display: inline-block;
    width: 47%;
  }
}

@media(max-width: 520px){
  .card-wrapper{
    margin: 2px 1.5%;
    display: inline-block;
    width: 97%;
  }
}

//Colors
.g-yellow{
  background-image: linear-gradient( 135deg, #FDEB71 0%, #F8D800 100%);
}

.g-white{
  background-image: linear-gradient( 135deg, #FFF 0%, #DEDEDE 100%);
}

.g-blue{
  color: $white;
  background-image: linear-gradient( 135deg, #ABDCFF 0%, #0396FF 100%);
  &.alt{
    background-image: linear-gradient( 135deg, #5EFCE8 0%, #736EFE 100%);
  }
}

.g-green{
  color: $white;
  background-image: linear-gradient( 135deg, #81FBB8 0%, #28C76F 100%);
}

.g-salmon{
  color: $white;
  background-image: linear-gradient( 135deg, #FEB692 0%, #EA5455 100%);
}

.g-purple{
  color: $white;
  background-image: linear-gradient( 135deg, #E2B0FF 0%, #9F44D3 100%);
  &.alt{
    background-image: linear-gradient( 135deg, #F761A1 0%, #8C1BAB 100%);
  }
}

.g-pink{
  color: $white;
  background-image: linear-gradient( 135deg, #F6CEEC 0%, #D939CD 100%);
}

.g-dark-green{
  color: $white;
  background-image: linear-gradient( 135deg, #92FFC0 0%, #002661 100%);
}

.g-turquoise{
  color: $white;
  background-image: linear-gradient( 135deg, #90F7EC 0%, #32CCBC 100%);
}

//Animation

@keyframes animateBg {
	from { background-position: 0 0; }
	to { background-position: 100% 900%; }
}
              
            
!

JS

              
                $('.dropdown-toggle').click(function(e){
  e.preventDefault();
  $(e.currentTarget).parent().toggleClass('open');
});

$('.dropdown-link').click(function(e){
  e.preventDefault();
  $(e.currentTarget).closest('.dropdown').removeClass('open');
});

$('.card').on('mouseleave', function(e){
  $(e.currentTarget).find('.dropdown').removeClass('open');
});
              
            
!
999px

Console