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

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>
  <div id="mi-blk1">blk1</div>
  <div id="mi-blk2">blk2</div>
  <div id="mi-blk3">blk3</div>
  <div id="mi-blk4">blk4</div>
  <div id="mi-blk5">blk5</div>
  <div id="mi-blk6">blk6</div>
</div>
            
          
!
            
              @import "compass/css3";

// Mixins
// Los mixins son como las funciones pero estas no devuelven
// un valor de retorno y no es obligatorio definir parámetros.

// Mixin sin parámetros.

@mixin blk {
  background-color: blue;
  width: 40px;
  height: 40px;
}

#mi-blk1 {
  @include blk;
}

// Mixin con un parámetro

@mixin blk2 ($color) {
  background-color: $color;
  width: 40px;
  height: 40px;
}

#mi-blk2 {
  @include blk2(red);
}

// Mixin con 2 parámetros y uno con un valor por defecto

@mixin blk3 ($color, $ancho: 60px) {
  background-color: $color;
  width: $ancho;
  height: 40px;
}

#mi-blk3 {
  @include blk3(grey, 40px);
}

#mi-blk4 {
  @include blk3(green);
}

// Funciones
//
// Las funciones son parecidas a los mixins pero estas pueden
// devolver valores.

// Usar Funciones

#mi-blk5 {
  width: 40px;
  height: 40px;
  // La función darken() oscurese un color, en este caso el
  // amarillo.
  background-color: darken(yellow,30%);
}

// Crear una función

// calcular el numero aureo

@function golden-radio($numero) {
  // Devuelvo el número áureo
  @return floor($numero / 1.62);
}

#mi-blk6 {  
  width: golden-radio(80px); // = 49.3
  height: 40px;
  background-color: darkgreen;
}
            
          
!
            
              /**
 *  Ejemplo de Matías Muñoz para elementalcode.net
 */
            
          
!
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