Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

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

              
                // Matryoshka LARGE
.matryoshka--01
  .matryoshka--01__head
    .matryoshka--01__head--face
      .matryoshka--01__head--face__hair.matryoshka--01__head--face__hair--left
      .matryoshka--01__head--face__hair.matryoshka--01__head--face__hair--right
    .matryoshka--01__eye.matryoshka--01__eye--left
    .matryoshka--01__eye.matryoshka--01__eye--right
    .matryoshka--01__lips
  .matryoshka--01__body
    .matryoshka--01__body__belly--top
      ul
        each i in new Array(6)
          li
    .matryoshka--01__body__belly--bottom
      ul
        each i in new Array(10)
          li
      ul
        each i in new Array(9)
          li
  .matryoshka--01__feet
      
// Matryoshka MEDIUM
.matryoshka--02
  .matryoshka--02__head
    .matryoshka--02__head--face
      .matryoshka--02__head--face__hair.matryoshka--02__head--face__hair--left
      .matryoshka--02__head--face__hair.matryoshka--02__head--face__hair--right
    .matryoshka--02__eye.matryoshka--02__eye--left
    .matryoshka--02__eye.matryoshka--02__eye--right
    .matryoshka--02__lips
  .matryoshka--02__body
    .matryoshka--02__body__belly--top
      ul
        each i in new Array(6)
          li
    .matryoshka--02__body__belly--bottom
      ul
        each i in new Array(10)
          li
      ul
        each i in new Array(9)
          li
  .matryoshka--02__feet
      
// Matryoshka SMALL
.matryoshka--03
  .matryoshka--03__head
    .matryoshka--03__head--face
      .matryoshka--03__head--face__hair.matryoshka--03__head--face__hair--left
      .matryoshka--03__head--face__hair.matryoshka--03__head--face__hair--right
    .matryoshka--03__eye.matryoshka--03__eye--left
    .matryoshka--03__eye.matryoshka--03__eye--right
    .matryoshka--03__lips
  .matryoshka--03__body
    .matryoshka--03__body__belly--top
      ul
        each i in new Array(6)
          li
    .matryoshka--03__body__belly--bottom
      ul
        each i in new Array(10)
          li
      ul
        each i in new Array(9)
          li
  .matryoshka--03__feet

// Matryoshka HEADLINE/TEXT
h1.name [matryoshka]
p.tip resize browser or tilt device to see more/less
              
            
!

CSS

              
                // COLOR VARIABLES
$color-1: #F6B352; // Yellow
$color-2: #ff5f2e; // Orange
$color-3: #ffdecb; // Creamy
$color-4: #44633F; // Green
$color-5: #f3f5f6; // Gray
  
// RESETS
body {
  min-width: 320px;
  background-color: $color-5;
  font-family: 'Hind', sans-serif;
  text-align: center;
}

:before,
:after {
  content: '';
}

ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

// HEADLINE & TEXT
.name {
  color: $color-2;
  font-size: 2.8em;
  letter-spacing: 5px;
  line-height: 1;
  margin-bottom: 0;
}

.tip {
  color: $color-1;
  margin-bottom: 40px;
}

// SHAPE MIXIN
@mixin shape ($width, $height: null) {
    width: $width;
    height: $height;
    
    @if $height == null {
      height: $width;
    }
}
  
// ILLUSTRATION MIXIN
@mixin matryoshka ($size) {
  // SHAPE VARIABLES
  $border: $size * 0.01;
  $body-h: $size * 1.2;
  $head-w: $size * 0.66666667;
  $head-h: $size * 0.76666667;
  $face-w: $size * 0.43333333;
  $face-h: $size * 0.46666667;
  $hair-1: $size * 0.24666667; 
  $hair-2: $size * 0.22666667; 
  $eyes: $size * 0.03333333;
  $cheek-w: $size * 0.05333333;
  $cheek-h: $size * 0.01333333;
  $lips-w: $size * 0.08;
  $bandana: $size * 0.28;
  $belly-h: $size * 0.13333333;
  $peek-1: $size * 0.05;
  $peek-2: $size * 0.08666667;

  // PLACEHOLDERS
  %circle {
    border-radius: 50%;
  }
   
  %position-relative {
    position: relative;
  }
  
  %position-absolute {
    position: absolute;
  }

  %cheek {
    @extend %circle;
    @include shape($cheek-w, $cheek-h);
    border: $border solid $color-1;
    display: block;
    margin-top: $cheek-w;
    margin-left: -50%;
  }

  %bandana {
    @extend %position-absolute;
    @include shape(0);
    border-style: solid;
    position: absolute;
    z-index: 10;
  }

  // CSS SELECTORS & PROPERTIES
  @extend %position-relative;
  width: $size;
  display: inline-block;
  margin: 30px;

  &__head {
    @extend %circle;
    @extend %position-relative;
    @include shape($head-w, $head-h);
    background-color: $color-4;
    margin-left: -($head-w / 2);
    left: 50%;

    &:after {
      @extend %bandana;
      border-width: 0 $bandana $bandana $bandana;
      border-color: transparent transparent $color-4 transparent;
      top: $bandana * 1.1;
      left: 8%;
    }

    &--face {
      @extend %circle;
      @extend %position-relative;
      @include shape($face-w, $face-h);
      background-color: $color-3;
      border: $border solid $color-2;
      box-sizing: border-box;
      margin-left: -($face-w / 2);
      overflow: hidden;
      top: 13%;
      left: 50%;
      z-index: 20;  

      &__hair {
        @extend %circle;
        @extend %position-absolute;
        background-color: $color-1;
        border: $border solid $color-2;
        box-sizing: border-box;
        top: -10%;
        z-index: 20;

        &--left { 
          @include shape($hair-1);
          left: 2%;
        }

        &--right {
          @include shape($hair-2);
          right: 0;
        }
      }
    }
  }

  &__eye {
    @extend %circle;
    @extend %position-absolute;
    @include shape($eyes);
    background-color: $color-2;
    top: 45%;
    z-index: 20;

    &--left {
      left: 30%;

      &:before {
        @extend %cheek;
      }
    }

    &--right {
      right: 30%;

      &:before {
        @extend %cheek;
      }
    }
  }

  &__lips {
    @extend %circle;
    @extend %position-absolute;
    @include shape($lips-w, $eyes);
    background-color: $color-2;
    top: 60%;
    left: 44%;
    z-index: 20;
  }

  &__body {
    @extend %position-relative;
    @include shape($size, $body-h);
    background-color: $color-2;
    border-radius: 50% 50% 50% 50%/60% 60% 40% 40%;
    margin-top: -30%;
    overflow: hidden;

    &:after {
      @extend %bandana;
      border-width: ($bandana * 1.7) $bandana 0 $bandana;
      border-color: $color-4 transparent transparent transparent;
      top: $bandana / 2.35;
      left: 22%;
    }

    &__belly {
      &--top {
        @extend %position-absolute;
        @include shape($size, $belly-h);
        background-color: $color-1;
        bottom: 34.5%;
        left: 0;

        li {
          @extend %circle;
          @include shape($eyes);
          background-color: $color-4;
          display: inline-block;
          margin-top: ($belly-h / 2) - ($eyes / 2);
          
          &:not(:first-child) {
            margin-left: ($size - ($eyes * 6)) / 8;
          }
        }
      }

      &--bottom {
        @extend %position-absolute;
        @include shape($size, ($belly-h * 2));
        background-color: $color-1;
        bottom: 7.5%;
        left: 0;

        ul {
          @include shape(($size * 1.5), $peek-2);
          overflow: hidden;
          text-align: left;

          &:first-of-type {
            margin-top: 4%;
          }

          &:last-of-type {
            margin-left: $peek-1;
          }
        }

        li {
          @include shape(0);
          border-style: solid;
          border-width: 0 $peek-1 $peek-2 $peek-1;
          border-color: transparent transparent $color-4 transparent;
          display: inline-block;

          &:not(:last-child) {
            margin-right: -1%;
          }
        }
      }
    }
  }

  &__feet {
    @extend %position-relative;
    @include shape($face-w, $cheek-w);
    border-radius: 10%;
    background-color: $color-1;
    margin: -3% auto;
    z-index: 10;
  }
}

// Let's make those ILLUSTRATIONS!
@for $i from 1 through 3 {
  // LARGE matryoshka
  $matryoshka-size: 400px; // Resize the matryoshka only by editing this variable

  @if $i == 2 {
    // MEDIUM matryoshka
    $matryoshka-size: 300px; // Resize the matryoshka only by editing this variable

    @media screen and (max-width: 75em) {
      .matryoshka--01 {
        display: none;
      }
    }
  } @else if $i == 3 {
    // SMALL matryoshka
    $matryoshka-size: 200px; // Resize the matryoshka only by editing this variable

    @media screen and (max-width: 44em) {
      .matryoshka {
        &--01,
        &--02 {
          display: none;
        }
      }
    }
  }
    
  .matryoshka--0#{$i} {
    @include matryoshka($matryoshka-size);
  }
}
              
            
!

JS

              
                /* 
 * PURE CSS MATRYOSHKAS
 * Resizable Matryoshkas with just 1 Sass edit.
 * By ilithya | 2016
 */
              
            
!
999px

Console