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 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

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

              
                <hr>
<p>Design use example: D-pad</p>
<div class="d-pad">
<div class='triangle up'></div>
<div class='triangle down'></div>
<div class='triangle left'></div>
<div class='triangle right'></div>
<div class='circle'></div>
</div>
<hr>
<p>Small (16px)</p>
<div class='small triangle up'></div>
<div class='small triangle down'></div>
<div class='small triangle left'></div>
<div class='small triangle right'></div>
<div class='small triangle down'></div>
<div class='small triangle up'></div>
<div class='small triangle right'></div>
<div class='small triangle left'></div>
<div class="clearfix"></div>
<hr>
<p>Default (32px)</p>
<div class='triangle up'></div>
<div class='triangle down'></div>
<div class='triangle left'></div>
<div class='triangle right'></div>
<div class='triangle down'></div>
<div class='triangle up'></div>
<div class='triangle right'></div>
<div class='triangle left'></div>
<div class="clearfix"></div>
<hr>
<p>Big (64px)</p>
<div class='big triangle up'></div>
<div class='big triangle down'></div>
<div class='big triangle left'></div>
<div class='big triangle right'></div>
<div class='big triangle down'></div>
<div class='big triangle up'></div>
<div class='big triangle right'></div>
<div class='big triangle left'></div>
<div class="clearfix"></div>
              
            
!

CSS

              
                @import "nib"

/**
 * How to make 3-corner-rounded triangle in CSS (SO)
 * http://stackoverflow.com/q/14446677/1397351
 * Forked from http://dabblet.com/gist/4592062
 * This example features the same result but with a Stylus mixin, marginfix and direction option
 */


triangle(direction = up, color = #333, size = 32px)
    position: relative
    background-color: color
    width:  2*(round(size/3.4))
    height: 2*(round(size/3.4))
    border-top-right-radius: 30%
    &:before,
    &:after
      content: ''
      position: absolute
      background-color: inherit
      width:  2*(round(size/3.4))
      height: 2*(round(size/3.4))
      border-top-right-radius: 30%

    if direction is up
      transform: rotate(-60deg) skewX(-30deg) scale(1,.866)
      margin: (@width/4) (@width/2.5) (@width/1.2) (@width/2.5)

    if direction is down
      transform: rotate(-120deg) skewX(-30deg) scale(1,.866)
      margin: 0 (@width/1.5) (@width/1.5) (@width/6)

    if direction is left
      transform: rotate(-30deg) skewX(-30deg) scale(1,.866)
      margin: (@width/5) 0 (@width) (@width/1.4)

    if direction is right
      transform: rotate(-90deg) skewX(-30deg) scale(1,.866)
      margin: (@width/5) (@width/1.4) (@width) 0

    &:before
      transform: rotate(-135deg) skewX(-45deg) scale(1.414,.707) translate(0,-50%)
    &:after
      transform: rotate(135deg) skewY(-45deg) scale(.707,1.414) translate(50%)


.triangle
  float left

.triangle
  &.up
    triangle()
  &.down
    triangle(down)
  &.left
    triangle(left)
  &.right
    triangle(right)

.triangle.small
  &.up
    triangle(up,hotpink,16px)
  &.down
    triangle(down,hotpink,16px)
  &.left
    triangle(left,hotpink,16px)
  &.right
    triangle(right,hotpink,16px)

.triangle.big
  &.up
    triangle(up,orange,64px)
  &.down
    triangle(down,orange,64px)
  &.left
    triangle(left,orange,64px)
  &.right
    triangle(right,orange,64px)
  
/* D-Pad */
.d-pad
  width 160px
  height 160px
  margin 0 auto
  display block
  position relative
  .triangle
    position absolute
    &.up,
    &.down
      left 50%
    &.up
      top 0
      margin-left -11px
    &.down
      bottom 0
      margin-left -14px
    &.left,
    &.right
      top 50%
      margin-top -16px
    &.left
      left 0
    &.right
      right 0
  .circle
    position absolute
    top 50%
    left 50%
    transform: translate(-50%, -50%);
    width 64px
    height 64px
    background #333
    border-radius 50%

/* Educational hover & Pen styling */
.triangle:hover
  background: rgba(0,0,255,.5)
    &:before
      background: rgba(255,0,0,.5)
    &:after
      background: rgba(255,255,0,.5)

body
  margin 0 auto
  padding 0
  max-width 80%
  font-family sans-serif
  text-transform uppercase
  color #ccc
  font-size 12px
hr
  clear both
  width 100%
  height 4px
  background #e4e4e4
  border 0
  margin 20px 0 5px
p
  text-align right
  margin-top 0

.clearfix
  clear both
  width 100%
  float none
              
            
!

JS

              
                
              
            
!
999px

Console