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

              
                input(type='radio', name='choice', id='spaces', checked)
input(type='radio', name='choice', id='tabs')
mixin card(content, answer, id)
  .card(class=`${answer ? 'card--answer' : ''} ${id ? `card--${id}` : ''}`)
    .card__content= content
    footer.card__footer
      -if(answer)
        img(src="http://blog.codepen.io/wp-content/uploads/2012/06/Button-Black-Small.png")
      -else
        img(src="http://blog.codepen.io/wp-content/uploads/2012/06/Button-White-Small.png")
      span Cards Against Developers
label(for='tabs')
label(for='spaces')
+card('_______ are better than _______.')
+card('Tabs', true, 'tabs')
+card('Spaces', true, 'spaces')
              
            
!

CSS

              
                *
  box-sizing border-box

input
  visibility hidden

body
html
  align-items center
  background #db0a5b
  display flex
  font-size 10px
  justify-content center
  margin 0
  min-height 100vh
  padding 0

  @media(min-width 768px)
    font-size 14px

  @media(min-width 992px)
    font-size 16px

$cardWidth = 20rem
.card
  background #000
  border-radius 1.25rem
  color #fff
  filter drop-shadow(5px 5px 5px black)
  flex-shrink 0
  font-family sans-serif
  font-size 1.5rem
  font-weight bolder
  height ($cardWidth * 1.4)
  padding 2.5rem
  position absolute
  transition transform .25s ease-out
  width $cardWidth

  &:nth-of-type(1)
    transform translate(-40%, 0) rotate(-15deg)

  &__footer
    align-items center
    bottom 30px
    display flex
    font-size .75rem
    left 2.5rem
    position absolute
    right 2.5rem

    img
      height 2rem
      margin-right 6px
      width 2rem

  &--answer
    color #000
    background #fff

#spaces:checked
  ~ .card--spaces
    transform translate(40%, 0) rotate(15deg) translate(0, 10%)
    z-index 2
  ~ .card--tabs
    transform translate(40%, 0) rotate(15deg) translate(0, -10%)
    z-index 1
  ~ label[for='tabs']
    z-index 3

#tabs:checked
  ~ .card--tabs
    transform translate(40%, 0) rotate(15deg) translate(0, 10%)
    z-index 2
  ~ .card--spaces
    transform translate(40%, 0) rotate(15deg) translate(0, -10%)
    z-index 1
  ~ label[for='spaces']
    z-index 3

label
  height ($cardWidth * 1.4) * 1.2
  position absolute
  transform translate(40%, 0) rotate(15deg)
  width $cardWidth
              
            
!

JS

              
                
              
            
!
999px

Console