Pen Settings



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


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


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.


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.


                <ul class="pixel-block">
  <li class="pixel-block--carrot"></li>


                // Setting the colors we're syncing up with
$pixel-color-map: (
  'o': transparent,
  'c': #f39c12,
  'g': #163D17,
  'b': #000

// Size of the pixels
$pixel-size: 20px;

// Mario pixel art matrices!
  carrot: (
    (o o o o o o o o o o o b b b o)
    (o o o o o o o o o o b g g b b)
    (o o o o o o o b b o b g b g b)
    (o o o o o o b c c b g b g g b)
    (o o o o o b c b c c b g b b o)
    (o o o o b c c c b c c b o o o)
    (o o o b c c c c c c c c b o o)
    (o o b c c c c c c c c c b o o)
    (o o b c c b c c c c c b o o o)
    (o b c c c c b c c c b o o o o)
    (o b c c b c c b c b o o o o o)
    (b c c c c b c b b o o o o o o)
    (b c c c c b b o o o o o o o o)
    (o b b b b o o o o o o o o o o)

// Function to read the matrix and pixelize it!
@function pixelize($matrix, $size){
    $l: length($matrix); // length of the entire
    $sh: ''; // shadows list
    $i: $l; // length of the line

    // read through the length of the matrix and decide on the box shadow color and position
    @for $i from 1 through $l{
      $row: nth($matrix,$i); //

      @for $j from 1 through length($row){
          $item: nth($row,$j);

          @if map-has-key($pixel-color-map, $item) {
            $sh:  $sh + ($j*$size) + ' ' + ($i*$size) + ' ' + map-get($pixel-color-map, $item);
          } @else {
            @warn 'there is no color specified in "$pixel-color-map" for: "#{$item}"';

        @if not ($j == length($row) and $i == $l) {
          $sh: $sh + ',';

    @return unquote($sh);

// Mixin to style each item
@mixin style-item($matrix, $size){
  position: relative; // pixels stack next to each other

  // set width & height of icon based on size of pixels
  width:($size * length(nth($matrix,1)));
  height:($size * length($matrix));

    content: '';

    // position everything from the top left corner
    position: absolute;
    top: (-$size);
    left: (-$size);
    width: $size;
    height: $size;

    // this is where we make the stitch
    box-shadow: pixelize($matrix,$size);

// Page styling
body {
  background: #2ECC40;

  list-style: none;
  margin: 3em auto;
  max-width: 800px;
  padding: 0;
  text-align: center;
  width: 100%;

  li {
    display: inline-block;

   @each $key, $value in $pixel-art{
      @include style-item($value, $pixel-size);