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

              
                %body
  .nav
    .text-options
      %i.zmdi.zmdi-font.trigger
      .dropdown
        %ul
          %li
            %ul.font
              %li
                .font-wrapper.pt-serif
                  Aa
              %li
                .font-wrapper.crimson-text
                  Aa
              %li
                .font-wrapper.source-sans-pro
                  Aa
              %li
                .font-wrapper.lato
                  Aa
            %hr
            %ul.font-size
              %li
                .size-wrapper
                  %i.zmdi.zmdi-format-size.size-big
              %li
                .size-wrapper
                  %i.zmdi.zmdi-format-size.size-medium
              %li
                .size-wrapper
                  %i.zmdi.zmdi-format-size.size-small
              %li
                .size-wrapper
                  %i.zmdi.zmdi-format-size.size-smaller
            %hr
            %ul.margin-size
              %li
                .margin-wrapper
                  %i.zmdi.zmdi-format-align-justify.margin-smaller
              %li
                .margin-wrapper
                  %i.zmdi.zmdi-format-align-justify.margin-small
              %li
                .margin-wrapper
                  %i.zmdi.zmdi-format-align-justify.margin-medium
              %li
                .margin-wrapper
                  %i.zmdi.zmdi-format-align-justify.margin-big
            %hr
            %ul.font-color
              %li
                .circle-wrapper
                  .circle.white
              %li
                .circle-wrapper
                  .circle.dark
              %li
                .circle-wrapper
                  .circle.sepia
              %li
                .circle-wrapper
                  .circle.blue

      .margin.margin-small
      .margin.margin-medium
      .margin.margin-big
  .text
    .text-wrapper
      %p
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam gravida purus sit amet sem interdum, eu sagittis augue varius. Sed a purus vel nunc dictum ullamcorper vitae at lacus. Ut diam libero, vestibulum nec lacus id, pharetra condimentum mauris. Nulla ut congue odio, nec consequat odio. Etiam laoreet finibus nisi non dignissim. Ut viverra odio sit amet odio posuere sagittis. Aliquam sed vehicula nibh, vel pharetra odio. Nullam sit amet aliquet elit.
      %p
        Aliquam viverra, enim id ultricies semper, nisi magna interdum leo, non malesuada sapien justo id arcu. Maecenas ultricies consectetur nibh. Nullam in libero felis. Integer quam velit, placerat ut nibh sed, gravida mollis turpis. Fusce porta pretium dui, sed laoreet leo commodo vitae. Morbi sit amet ipsum tempus, ornare enim non, aliquet ex. Suspendisse potenti.
      %p
        Aliquam ut turpis efficitur, tincidunt ex iaculis, ultrices ipsum. Nulla consectetur, nunc eget condimentum efficitur, dui felis dignissim mi, a tincidunt ex tellus ac diam. Donec eros massa, pharetra ut suscipit id, aliquet sed neque. Fusce nibh leo, tincidunt varius ullamcorper vel, maximus at orci. Aliquam commodo, risus a ornare condimentum, sem sapien rutrum libero, vel pellentesque augue arcu porta odio. Integer fermentum felis in turpis placerat, at posuere nisl rutrum. Nullam dapibus tortor eget mi cursus, at dignissim mi mollis. Sed fringilla sem libero, quis tristique erat scelerisque nec. Duis aliquam semper nisi.
      %p
        Ut ut porta nisi, in porttitor diam. Sed ut neque quis nibh mollis vehicula non et nulla. Suspendisse velit nunc, posuere vitae cursus in, viverra ac magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce sed eleifend lorem. Nam pellentesque maximus mattis. Nullam sed lorem congue, dictum urna pharetra, mattis neque. Ut commodo ante non aliquam vestibulum. Aliquam mattis tortor sed quam commodo porttitor.

              
            
!

CSS

              
                * {
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
}

body {
  background: #FDFDFD;
  font-family: 'PT Serif', serif;
  transition: 0.3s;
}

.nav {
  width: 100vw;
  height: 6em;
  background: rgba(255,255,255,0);
  position: fixed;
  top: 0;
  left: 0;
}

ul, li, hr {
  list-style: none;
  padding: 0;
  margin: 0;
}

hr {
  background: #dcdcdc;
  border: 0;
  height: 1px;
}

ul.font-size li:nth-child(1) {
  position: relative;
  top: 0.19em;
}

ul.font-size li:nth-child(2) {
  position: relative;
  top: 0.07em;
}

ul.font-size li:nth-child(3) {
  position: relative;
  top: -0.11em;
}

ul.font-size li:nth-child(4) {
  position: relative;
  top: -0.2em;
}

.margin-small {
  -webkit-clip-path: inset(0 5% 0 5%);
  clip-path: inset(0 5% 0 5%);
}

.margin-medium {
  -webkit-clip-path: inset(0 10% 0 10%);
  clip-path: inset(0 10% 0 10%);
}

.margin-big {
  -webkit-clip-path: inset(0 15% 0 15%);
  clip-path: inset(0 15% 0 15%);
}

.margin-wrapper:hover, .circle-wrapper:hover, .size-wrapper:hover, .font-wrapper:hover {
  background: #e4e4e4;
}

.margin-smaller, .margin-small, .margin-medium, .margin-big {
  font-size: 1.4em
}

.font-wrapper {
  font-size: 1.5em;
  width: 2.34em !important;
  height: 2em !important;
}

.pt-serif {
  font-family: 'PT Serif', serif;
}

.crimson-text {
  font-family: 'Crimson Text', serif;
}

.source-sans-pro {
  font-family: 'Source Sans Pro', serif;
}

.lato {
  font-family: 'Lato', serif;
}

.circle-wrapper, .margin-wrapper, .size-wrapper, .font-wrapper {
  width: 3.5em;
  height: 3em;
  display: flex;
  align-items: center;
  justify-content: center
}

.circle {
  width: 2em;
  height: 2em;
  border-radius: 50%
}

.white {
  background: #fff;
  border: 0.2em solid #dedede;
}

.dark {
  background: black;
  border: 0.2em solid black;
}

.sepia {
  background: #FBF0D9;
  border: 0.2em solid #624D3D;
}

.blue {
  background: #1C1F2B;
  border: 0.2em solid #0f1119;
}

.size-big {
  font-size: 2em;
}

.size-medium {
  font-size: 1.6em;
}

.size-small {
  font-size: 1.2em;
}

.size-smaller {
  font-size: 0.8em;
}

.text-wrapper {
  margin: 4em 8vw 3em 8vw;
  font-size: 1.3em;
  color: #313131;
  // transition: 0.3s
}

.dropdown {
  opacity: 0;
  position: fixed;
  top: 3em;
  right: 8vw;
  z-index: 10;
  background: #f5f5f5;
  border-radius: 3px;
  box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.2);
  transition: opacity 0.2s, transform 0.5s;
  pointer-events: none !important;
  user-select: none;
  -moz-user-select: none;
  -khtml-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
  ul li ul li{
    font-size: 0.9em;
    cursor: pointer;
    display: inline-block;
  }
}

.dropdown.expanded {
  pointer-events: initial !important;
  opacity: 1;
  transition: 0.5s;
  transform: translateY(1em);
}

.trigger {
  position: fixed;
  right: 8vw;
  font-size: 2em;
  padding: 0.3em 0.3em 0.3em 0em;
  cursor: pointer;
  color: #313131;
  top: 0.5em;
  transition: 0.5s
}

.nav:hover .trigger, .nav:focus .trigger, .nav:active .trigger {
  opacity: 1 !important;
}

@media screen and (max-width: 400px) {
  .text-wrapper {
    margin: 4em 2vw 3em 2vw;
  }
  .text {
    font-size: 80%;
  }
  .trigger, .dropdown {
    right: 2vw
  }
}

@media screen and (min-width: 401px) and (max-width: 600px) {
  .text {
    font-size: 90%;
  }
  .trigger, .dropdown {
    right: 4vw
  }
}

@media screen and (min-width: 401px) and (max-width: 600px) {
  .text-wrapper {
    margin: 4em 4vw 3em 4vw;
  }
}

@media screen and (min-width: 601px) and (max-width: 800px) {
  .text-wrapper {
    margin: 4em 6vw 3em 6vw;
  }
  .trigger, .dropdown {
    right: 6vw
  }
}

@media screen and (min-width: 801px) {
  .text-wrapper {
    margin: 4em 8vw 3em 8vw;
  }
  .trigger, .dropdown {
    right: 8vw
  }
}

@media screen and (min-width: 601px) {
  .text {
    font-size: 100%;
  }
}
              
            
!

JS

              
                $(document).on 'click', 'ul.margin-size li:nth-child(1)', ->
  if $(window).width() < 400
    $('.text-wrapper').css 'margin', '4em 2vw 3em 2vw'
  else if $(window).width() < 600
    $('.text-wrapper').css 'margin', '4em 4vw 3em 4vw'
  else if $(window).width() < 800
    $('.text-wrapper').css 'margin', '4em 6vw 3em 6vw'
  else
    $('.text-wrapper').css 'margin', '4em 8vw 3em 8vw'
  
$(document).on 'click', 'ul.margin-size li:nth-child(2)', ->
  if $(window).width() < 400
    $('.text-wrapper').css 'margin', '4em 4vw 3em 4vw'
  else if $(window).width() < 600
    $('.text-wrapper').css 'margin', '4em 6vw 3em 6vw'
  else if $(window).width() < 800
    $('.text-wrapper').css 'margin', '4em 8vw 3em 8vw'
  else
    $('.text-wrapper').css 'margin', '4em 10vw 3em 10vw'
  
$(document).on 'click', 'ul.margin-size li:nth-child(3)', ->
  if $(window).width() < 400
    $('.text-wrapper').css 'margin', '4em 6vw 3em 6vw'
  else if $(window).width() < 600
    $('.text-wrapper').css 'margin', '4em 8vw 3em 8vw'
  else if $(window).width() < 800
    $('.text-wrapper').css 'margin', '4em 10vw 3em 10vw'
  else
    $('.text-wrapper').css 'margin', '4em 12vw 3em 12vw'
  
$(document).on 'click', 'ul.margin-size li:nth-child(4)', ->
  if $(window).width() < 400
    $('.text-wrapper').css 'margin', '4em 8vw 3em 8vw'
  else if $(window).width() < 600
    $('.text-wrapper').css 'margin', '4em 10vw 3em 10vw'
  else if $(window).width() < 800
    $('.text-wrapper').css 'margin', '4em 12vw 3em 12vw'
  else
    $('.text-wrapper').css 'margin', '4em 14vw 3em 14vw'
  
  
$(document).on 'click', 'ul.font-size li:nth-child(1)', ->
  $('.text-wrapper').css 'font-size', '1.5em'
  
$(document).on 'click', 'ul.font-size li:nth-child(2)', ->
  $('.text-wrapper').css 'font-size', '1.3em'
  
$(document).on 'click', 'ul.font-size li:nth-child(3)', ->
  $('.text-wrapper').css 'font-size', '1.2em'

$(document).on 'click', 'ul.font-size li:nth-child(4)', ->
  $('.text-wrapper').css 'font-size', '1.1em'
  
  
$(document).on 'click', 'ul.font li:nth-child(1)', ->
  $('body').css 'font-family', 'PT-Serif, serif'
  
$(document).on 'click', 'ul.font li:nth-child(2)', ->
  $('body').css 'font-family', 'Crimson Text, serif'
  
$(document).on 'click', 'ul.font li:nth-child(3)', ->
  $('body').css 'font-family', 'Source Sans Pro, serif'

$(document).on 'click', 'ul.font li:nth-child(4)', ->
  $('body').css 'font-family', 'Lato, serif'
  
  
$(document).on 'click', 'ul.font-color li:nth-child(1)', ->
  $('body').css 'background', '#FDFDFD'
  $('.text-wrapper').css 'color', '#313131'
  $('.trigger').css 'color', '#313131'
  
$(document).on 'click', 'ul.font-color li:nth-child(2)', ->
  $('body').css 'background', '#292929'
  $('.text-wrapper').css 'color', '#ccc'
  $('.trigger').css 'color', '#ccc'
  
$(document).on 'click', 'ul.font-color li:nth-child(3)', ->
  $('body').css 'background', '#FBF0D9'
  $('.text-wrapper').css 'color', '#5b4636'
  $('.trigger').css 'color', '#5b4636'
  
$(document).on 'click', 'ul.font-color li:nth-child(4)', ->
  $('body').css 'background', '#1C1F2B'
  $('.text-wrapper').css 'color', '#bdcadb'
  $('.trigger').css 'color', '#bdcadb'
  
$(document).click (e) ->
  if $(e.target).is('.trigger')
    $('.dropdown').toggleClass 'expanded'

$(document).on 'click', '.text-wrapper', ->
  $('.dropdown').removeClass 'expanded'

  
$(window).scroll ->
  if !$('.dropdown').hasClass 'expanded' 
    scrollTop = $(window).scrollTop()
    height = $(window).height()
    $('.trigger').css 'opacity': (height - scrollTop) / height

              
            
!
999px

Console