cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

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

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

Code Indentation

     

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.

            
              <div>
  <a href="#" class="btn">Lightness: </a><br>
  <a href="#" class="btn">Lightness: </a><br>
  <a href="#" class="btn">Lightness: </a>
</div>
            
          
!
            
              $white: #FDFDFD;
$black: #121212;

$col_1: #F0C0DF;
$col_2: #18C7B2;
$col_3: #47075E;

$value_1: lightness($col_1);
$value_2: lightness($col_2);
$value_3: lightness($col_3);

@function set-button-color($color) {
  @if (lightness($color) > 50) {
    @return black;
  } @else {
    @return white;
  }
}

@function set-button-shadow($c){
  @if (lightness($c) >= 70) {
    @return 8%;
  } 
  @if (lightness($c) <= 69){
    @return 14%
  }
  @if (lightness($c) <= 30) {
    @return 27%;
  }
}

@mixin button($c){
    margin-top: 10px;
    margin-right: 10px;
    padding: 14px 26px;
    font-size: 1em;
    color: set-button-color($c);
    display:inline-block;
    vertical-align: middle;
    text-align: center;
    cursor: pointer;
    transition: background 0.1s ease-in-out;
    border-radius: 3px;
    outline: 0 none;
    border: 0px solid none;
    background-color: $c;
    box-shadow: 0px 6px 0px 0px darken($c, set-button-shadow($c));
    
    &:hover, 
    &:focus{
        background-color: saturate($c, 20%);
    }
    
    &:active, 
    &:focus{
        margin-top: 18px;
        outline: 0 none;
        box-shadow: 0px 1px 0px 0px darken($c, 25%);
    }
}

body{
  background: $white;
  font:{
    family: Roboto;
    weight: 400;
    size: 20px;
  }
  text-transform: uppercase;
}

div{
  width: 70%;
  text-align: center;
  top: 50%;
  left: 50%;
  position: absolute;
  transform: translate(-50%, -50%);
}

a{
  text-decoration: none;
}

.btn:nth-of-type(1){
  @include button($col_1);
  &:after{   
      content: quote(#{$value_1});
  }
}

.btn:nth-of-type(2){
  @include button($col_2);
  &:after{   
      content: quote(#{$value_2});
  }
}
.btn:nth-of-type(3){
  @include button($col_3);
  &:after{   
      content: quote(#{$value_3});
  }
}
            
          
!
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