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

              
                <section>
  <div class="tag">lorem</div>
  <div class="tag">ipsum</div>
  <div class="tag">dolor</div>
</section>

<section>
  <div class="tag--white">lorem</div>
  <div class="tag--white">ipsum</div>
  <div class="tag--white">dolor</div>
</section>

<section>
  <div class="tag--white">lorem</div>
  <div class="tag--white">ipsum</div>
  <div class="tag--white">dolor</div>
</section>

<section>
  <div class="tag">lorem</div>
  <div class="tag">ipsum</div>
  <div class="tag">dolor</div>
</section>
              
            
!

CSS

              
                @import "nib"

/* PRESENTATIONAL CRUFT */
html {
  height 100%
}
body {
  font-family sans-serif
  display flex
  flex-direction column
  height 100%
}

section {
  padding 2em
  flex 1 0 auto
  display flex
  align-content center
  align-items center
  text-align center
  flex-direction row
  justify-content center
  &:nth-child(1) {
    background-color powderblue
  }
  &:nth-child(2) {
    background-color orangered
  }
  &:nth-child(3) {
    background-color yellowgreen
  }

  &:nth-child(4) {
    background-color gold
  }
}

/* THE IMPORTANT STUFF */

$font-size = 1em
$tag-height = $font-size * 2
$tag-color = black
$line-weight = 2px

/* One day I'll make it handle 'transparent' better. 
   You may encounter some overlap due to rounding
   if you use semi-transparent colors. Sorry. 
*/
$tag-fill = rgba(white,.25)
  
/* Some Math using Stylus's undocumented math function... 
   https://bit.ly/1op7QPn 
*/
$x = math(($tag-height ** 2) * 2, 'sqrt') / 2

tag($tag-color) {
  font-size $font-size
  background-color $tag-fill
  border $line-weight solid $tag-color
  border-left none
  display inline-block
  position relative
  border-radius 0 .25em .25em 0
  padding 0 ($tag-height * .25) 0 ($tag-height * .35)
  line-height $tag-height
  overflow visible
  height $tag-height
  color $tag-color
  margin-left $x

  &:after {
    content " "
    absolute top ($tag-height * .5) left 0
    transform-origin 50% 50%
    transform translate(-50%,-50%)
    width $tag-height * .15
    height $tag-height * .15
    background-color $tag-color
    border-radius 50%
    box-sizing border-box
  }
  
  &:before {
    content " "
    background-color $tag-fill
    background: linear-gradient(
      135deg, 
      rgba($tag-fill,alpha($tag-fill)) 0%,
      rgba($tag-fill,alpha($tag-fill)) 47%,
      rgba($tag-fill,0) 47%,
      rgba($tag-fill,0) 100%
    )
    width $x
    height $x
    absolute top ($tag-height * .5) left 0
    transform-origin 50% 50%
    transform translate(-50%,-50%) rotate(-45deg)
    display block
    border-top $line-weight solid $tag-color
    border-left $line-weight solid $tag-color
    z-index 0
  }
}

.tag {
  tag(rgba(black,.6))
}

.tag--white {
  tag(rgba(white,.8))
}
              
            
!

JS

              
                
              
            
!
999px

Console