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='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 -regular center'>Let's start</div>
    
    <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 -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
:root {
  --color-dark:  #161616;
  --color-ocean:  #416dea;
  --color-grass: #3dd28d;
  --color-snow: #FFFFFF;
  --color-salmon: #F32C52;
  --color-sun: #feee7d;
  --color-alge: #7999a9;
  --color-flower: #353866;
  --color-smoke: #e4e4e4;
  
  --borderRadius: 36px;

  --font-face: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}


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



// body styles
body {
  display: flex;

  box-sizing: border-box;
  min-height: 100vh;

  background: whitesmoke;
  font-family: var(--font-face);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;

  justify-content: center;
  align-items: center;
  
  @media (min-width: 992px) {
    border-width: 30px;
  }
}

body.linked {
  
  .button, h1 {
    opacity: .3;
    transition: opacity 300ms linear;
  }
  
  p {
    color: var(--color-smoke);
    transition: color 300ms linear;
  }
}




// text styles
h1 {
  text-align: center;
  
  transition: opacity 300ms linear;

  color: var(--color-dark);

  font-family: var(--font-face);
  font-size: 32px;
  font-weight: 700;
  
  span {
    font-weight: 400;
  }
}

p {
  max-width: 460px;
  margin: 0 auto;

  transition: color 300ms linear;
  text-align: center; 

  color: var(--color-dark);

  font-weight: 400;
  line-height: 1.5;
}

a, a:visited {
  text-decoration: none;

  color: var(--color-ocean);

  font-weight: 500;
  
  &:hover {
    text-decoration: underline;
    color:var(--color-ocean);
  }
}




// container styles
.container {  
  display: flex;
  flex-direction: column;

  width: 100%;
  padding: 20px;
}

.button-container {
    display: flex;

    margin: 60px auto;

    flex-wrap: wrap;
    justify-content: center;
}




// button styles
.button {
  display: flex;
  overflow: hidden;

  margin: 10px;
  padding: 12px 12px;

  cursor: pointer;
  user-select: none;
  transition: all 150ms linear;
  text-align: center;
  white-space: nowrap;
  text-decoration: none !important;
  text-transform: none;
  text-transform: capitalize;

  color: #fff;
  border: 0 none;
  border-radius: var(--borderRadius);

  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;

  -webkit-appearance: none;
  -moz-appearance:    none;
  appearance:         none;
 
  justify-content: center;
  align-items: center;
  flex: 0 0 160px;
  
  box-shadow: 2px 5px 10px var(--color-smoke);

  &:hover {
    transition: all 150ms linear;

    opacity: .85;
  }
  
  &:active {
    transition: all 150ms linear;
    opacity: .75;
  }
  
  &:focus {
    outline: 1px dotted #959595;
    outline-offset: -4px;
  }
}

.button.-regular {
  color: #202129;
  background-color: #f2f2f2;
  
  &:hover {
    color: #202129;
    background-color: #e1e2e2;
    opacity: 1;
  }
  
  &:active {
    background-color: #d5d6d6;
    opacity: 1;
  }
}

.button.-dark {
  color: var(--color-snow);
  background: var(--color-dark);
  
   &:focus {
    outline: 1px dotted white;
    outline-offset: -4px;
  }
}
  
.button.-green {
  color: var(--color-snow);
  background: var(--color-grass);
}

.button.-blue {
  color: var(--color-snow);
  background: var(--color-ocean);
}

.button.-salmon {
  color: var(--color-snow);
  background: var(--color-salmon);
}

.button.-sun {
  color: #f15c5c;
  background: var(--color-sun);
}

.button.-alge {
  color: #e7ff20;
  background: var(--color-alge);
}

.button.-flower {
  color: #FE8CDF;
  background: var(--color-flower);
}
              
            
!

JS

              
                const	body = document.querySelector('body')
const twitter = document.querySelector('.twitter')

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

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

Console