cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv


A Pen By Captain Anonymous

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 class="container">
  <div class="function-based">
    <h2>Function based</h2>
    <a href="#" class="button button-confirm">Confirmation</a>
    <a href="#" class="button button-warning">Warning</a>
    <a href="#" class="button button-info">Info</a>
    <a href="#" class="button button-alert">Alert</a>

  <div class="contrast-based">
    <h2>Contrast based</h2>
    <a href="#" class="button button-confirm_contrasted">Confirmation</a>
    <a href="#" class="button button-warning_contrasted">Warning</a>
    <a href="#" class="button button-info_contrasted">Info</a>
    <a href="#" class="button button-alert_constrasted">Alert</a>
              @import "compass/css3";

Demo variables

$button_confirm: green;
$button_warning: #ffc53a;
$button_alert: red;
$button_info: teal;

With our own built function:

@function set-button-text-color($color) {

  @if (lightness( $color ) > 27) {
    @return black;
  @else {
    @return white;

.button-confirm {
  background: $button_confirm;
  color: set-button-text-color($button_confirm);

.button-warning {
  background: $button_warning;
  color: set-button-text-color($button_warning);

.button-info {
  background: $button_info;
  color: set-button-text-color($button_info);

.button-alert {
  background: $button_alert;
  color: set-button-text-color($button_alert);

With contrasted() from Compass:
@import "compass/utilities/color/contrast";
$contrasted-dark-default: black;
$contrasted-light-default: white;

.button-confirm_contrasted {
  @include contrasted($button_confirm, $contrasted-dark-default, $contrasted-light-default, 40);

.button-warning_contrasted {
  @include contrasted($button_warning);

.button-info_contrasted {
  @include contrasted($button_info);

.button-alert_constrasted {
  @include contrasted($button_alert);

* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;  

.function-based, .contrast-based {
  float: left;
  width: 49%;
  text-align: center;
  font-family: sans-serif;

.function-based { margin-right: 1%; }
.contrast-based { margin-left: 1%; }

.container {
  max-width: 900px;
  margin: 0 auto;

%button {
  text-decoration: none;
  padding: .5em 1em;
  width: 100%;
  margin: 1% auto;
  display: block;
  font-size: 1em;
  font-family: sans-serif;
  font-weight: bold;
  @include border-radius(10px);

.button {
  @extend %button;
Loading ..................