Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

Auto Save

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

              
                <div class="dog">
  <div class="collar"></div>
  <div class="neck"></div>
  <div class="tongue"></div>
  <div class="mouth"></div>
  <div class="face"></div>
  <div class="ear--left"></div>
  <div class="ear--right"></div>
  <div class="eye--left"></div>
  <div class="eye--right"></div>
  <div class="nose"></div>
  <div class="freckles--left"></div>
  <div class="freckles--right"></div>
</div>

              
            
!

CSS

              
                @import "compass/css3";

/* Puppy created using the Sassy Shape Machine Mixin!

based on this Dribbble: http://dribbble.com/shots/1146826-Pupface */

// Color Call:
$darkbrown: #523026;
$tan: #f4e5be;
$caramel: #cc9b59;
$orange: #f25a2b;
$gold: #e4bb3b;
$skyblue: #7dcdd4;
$pink: #f9b1e0;

// ****** Here's the Mixin!
@mixin shape($shape, $size, $color){
	@if $shape == square {
		width: $size;
		height: $size;
		background-color: $color;
	}
	@if $shape == circle {
		width: $size;
		height: $size;
		background-color: $color;
		border-radius: 50%;
	}
	@if $shape == triangle {
		width: 0;
		height: 0;
		border-left: $size solid transparent;
		border-right: $size solid transparent;
		border-bottom: $size*1.5 solid $color;
	}
	@if $shape == right-triangle {
		width: 0;
		height: 0;
		border-bottom: $size solid $color;
		border-right: $size solid transparent;
	}
	@if $shape == diamond {
		width: 0;
		height: 0;
		border: $size solid transparent;
		border-bottom-color: $color;
		position: relative;
		top: -$size;
	
		&:after {
			content: '';
			position: absolute;
			left: -$size;
			top: $size;
			width: 0;
			height: 0;
			border: $size solid transparent;
			border-top-color: $color;
		}
	}
	@if $shape == pentagon {
		position: relative;
		width: $size;
		border-width: (25/27)*$size (1/3)*$size 0;
		border-style: solid;
		border-color: $color transparent;
		
		&:before {
			content: "";
			position: absolute;
			height: 0;
			width: 0;
			top: (-17/11)*$size;
			left: (-1/3)*$size;
			border-width: 0 (5/6)*$size (35/54)*$size;
			border-style: solid;
			border-color: transparent transparent $color;
		}
	}
	@if $shape == hexagon {
		width: $size*2;
		height: $size*1.1;
		background: $color;
		position: relative;
		&:before {
			content: "";
			position: absolute;
			top: $size/-2;
			left: 0;
			width: 0;
			height: 0;
			border-left: $size solid transparent;
			border-right: $size solid transparent;
			border-bottom: $size/2 solid $color;
		}
		&:after {
			content: "";
			position: absolute;
			bottom: $size/-2;
			left: 0;
			width: 0;
			height: 0;
			border-left: $size solid transparent;
			border-right: $size solid transparent;
			border-top: $size/2 solid $color;
		}
	}
	@if shape == octogon {
		width: $size;
		height: $size;
		background: transparent;
		position: relative;
		text-align: center;
	
		&:before {
			content: "";
			position: absolute;
			top: 0;
			left: 0;
			border-bottom: 29/$size solid $color;
			border-left: 29/$size solid transparent;
			border-right: 29/$size solid transparent;
			width: 42/$size;
			height: 0;
		}
		
		&:after {
			content: "";
			position: absolute;
			bottom: 0;
			left: 0;
			border-top: 29/$size solid $color;
			border-left: 29/$size solid transparent;
			border-right: 29/$size solid transparent;
			width: 42/$size;
			height: 0;
		}
	}
}

// ****** end of the mixin :)

// ****** Here's the styling!

body {
  background: $skyblue;
  margin-top: -80px;
}

div {
  position: absolute;
  &:after {
    position: absolute;
  }
  &:before {
    position: absolute;
  }
}

.collar {
  @include shape(circle, 200px, $orange);
  margin: 210px 200px;
  &:after {
    @include shape(circle, 50px, $gold);
    content: "";
    margin: 100% 40%;
  }
}

.neck {
  @include shape(circle, 180px, $tan);
  margin: 200px 210px;
}

.mouth {
  @include shape(circle, 120px, $caramel);
  margin: 210px 180px;
  &:after {
    @include shape(circle, 120px, $caramel);
    content: "";
    margin: 0 95%;
  }
}

.face {
  background-color: $tan;
  height: 150px;
  margin: 120px 180px;
  width: 235px;
}

%ear {
  @include shape(right-triangle, 100px, $darkbrown);
  border-bottom: 150px solid $darkbrown;
  margin-top: 118px;
  &:after {
    @include shape(circle, 100px, $darkbrown);
    content: "";
    margin: 108px 0;
  }
}

.ear--left {
  @extend %ear;
  @include rotateY(180deg);
  margin-left: 80px;
}

.ear--right {
  @extend %ear;
  margin-left: 413px;
}

%eye {
  margin-top: 180px;
  width: 30px;
  height: 30px;
  border: 15px solid $darkbrown;
  border-radius: 50%;
  &:after {
    content: "";
    width: 60px;
    height: 30px;
    background-color: $tan;
    margin: 50% -50%;
  }
}

.eye--left {
  @extend %eye;
  margin-left: 200px;
}

.eye--right {
  @extend %eye;
  margin-left: 330px;
}

.nose {
  @include shape(triangle, 30px, $darkbrown);
  @include rotate(180deg);
  margin: 230px 267px;
  
}

%freckles {
  @include shape(circle, 15px, $darkbrown);
  margin-top: 285px;
  &:before {
    @include shape(circle, 15px, $darkbrown);
    content: "";
    margin: -20px 15px;
  }
  &:after{
    @include shape(circle, 15px, $darkbrown);
    content: "";
    margin: -20px -15px;
  }
}

.freckles--left {
  @extend %freckles;
  margin-left: 220px;
}

.freckles--right {
  @extend %freckles;
  margin-left: 350px;
}

.tongue {
  @include shape(circle, 50px, $pink);
  @include transition-duration(0.8s);
  margin: 240px 270px;
}

.dog {
  &:hover {
    .tongue{
      margin-top: 290px;
    }
  }
}
              
            
!

JS

              
                /* Link to my mixin:
https://gist.github.com/una/7198256#file-shape-mixin

p.s. hover over the dog ;)
*/
              
            
!
999px

Console