octocatstartv

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
via CSS Lint

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
via JS Hint

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.

HTML

            
              <div class='container'>
  <h1>
    Buttons
  </h1>
  <p>
    Random selection of button styles. May change over time as I get alot of stupid ideas. Feel free to follow me on  <a href="https://twitter.com/simonbusborg" target="_blank" class="twitter">twitter</a>
  </p>
  <div class="button-container">
    <div class='button -dark center'>Touch me</div>
    
    <div class='button -green center'>Just like that</div>
    
    <div class='button -blue center'>And that, oh, yeah</div>
    
    <div class='button -border center'>Now that's heaven</div>
    
    <div class='button -salmon center'>Now that I like</div>
    
    <div class='button -sun center'>God, that's so nice</div>
    
    <div class='button -alge center'>Now lower down</div>
    
    <div class='button -flower center'>Where the figs lie</div>
    
  </div>
</div>
            
          
!

CSS

            
              // colors
$dark:  #333030;
$ocean:  #2b90d9;
$grass: #3ac569;
$snow: #FFFFFF;
$salmon: #ff7473;
$sun: #feee7d;
$alge: #79a8a9;
$flower: #353866;

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

// font
$font-face: 'Roboto', sans-serif;

// reset
html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}

// body styles
body {
  background: white;
  font-family: $font-face;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  justify-content: center;
  align-items: center;
  
  min-height: 100vh;
  line-height: 1;
  
  box-sizing: border-box;
  
  border: 20px solid whitesmoke;
  
  @media (min-width: 992px) {
    border-width: 30px;
  }
}

body.linked {
  p {
     color: rgba($dark, .3);
  }
}

// text styles
h1 {
  text-align: center;
  font-family: $font-face;
  font-size: 32px;
  color: $dark;
  font-weight: 700;
  
  span {
    font-weight: 400;
  }
}

p {
  margin: 0 auto;
  font-weight: 400;
  color: rgba($dark, .6);
  max-width: 460px;
  text-align: center; 
  line-height: 1.5;
  
  transition: color 180ms ease;
}

a, a:visited {
  color: $ocean;
  text-decoration: none;
  font-weight: 500;
  
  &:hover {
    text-decoration: underline;
  }
}

// container styles
.container {  
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 20px;
}

.button-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 60px auto;
}


// button styles
.button {
  border: 0 none;
  border-radius: 24px;
  
  padding: 12px 18px;
  margin: 10px;
  
  cursor: pointer;
  
  display: flex;
  justify-content: center;
  align-items: center;
  
  flex: 0 0 160px;
  
  text-align: center;
  line-height: 1.3;
  font-size: 14px;
  color: #fff;
  text-transform: none;
  
  font-weight: 500;
  
  transition: all 60ms ease-in-out;

  &:hover {
    opacity: .95;
    transition: all 60ms ease;
  }
  
  &:active {
    opacity: .75;
    transform: scale(.97);
    transition: all 60ms ease;
  }
}

.button.-dark {
  background: $dark;
  color: $snow;
}
  
.button.-green {
  background: $grass;
  color: $snow;
}

.button.-blue {
  background: $ocean;
  color: $snow;
}

.button.-salmon {
  background: $salmon;
  color: $snow;
}

.button.-sun {
  background: $sun;
  color: #f15c5c;
}

.button.-alge {
  background: $alge;
  color: #f4f7f7;
}

.button.-flower {
  background: $flower;
  color: #FE8CDF;
}

.button.-border {
  background: transparent;
  border: 2px solid $ocean;
  color: $ocean;
  
  &:hover, &.-active {
    background: $ocean;
    border-color: $ocean;
    color: $snow;
  }
}
            
          
!

JS

            
              var	body     = document.getElementsByTagName('body')[0],
    twitter  = document.getElementsByClassName('twitter')[0];

twitter.addEventListener("mouseover",function() {
    body.classList.add('linked');
},false);

twitter.addEventListener("mouseout", function() {
    body.classList.remove('linked');
}, false);
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console