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

              
                .container
  header.text-center
    h1 Sass nest test
    p.text-mute 
      code @at-root
      |  is really necessary?
  .row
    .col.col-md-3
      p use 
        code!= "#{&}"
        |. generate nested css.
        br
        small.text-mute
          | note.
      pre.code
        | .foo
        != "\n  #{&}__bar\n"
        |    color: #000
        != "\n  #{&}--baz\n"
        |    color: #fff
      p.bold result
      pre.code.
        .foo .foo__bar {
          color: #000;
        }
        .foo .foo--baz {
          color: #fff;
        }
    .col.col-md-3
      p < v.3.3 
        code!= "@at-root #{&}..."        
        br
        small
          | ref. 
          a(href="https://html5experts.jp/kosei27/3297/", target="_blank", ref="noopener") https://html5experts.jp/kosei27/3297/
      pre.code
        | .foo
        |   @at_root
        != "\n    #{&}__bar\n"
        |      color: #000
        |   @at_root
        != "\n    #{&}--baz\n"
        |      color: #fff
      p.bold result
      pre.code.
        .foo__bar {
          color: #000;
        }
        .foo--baz {
          color: #fff;
        }
    .col.col-md-3
      p < v.3.3 
        code!= "@at-root"        
        br
        small.text-mute!= "don't need <code>#{&}</code>"
      pre.code
        | .foo
        |   @at_root
        |     &__bar
        |      color: #000
        |   @at_root
        |     &--baz
        |      color: #fff
      p.bold result
      pre.code.
        .foo__bar {
          color: #000;
        }
        .foo--baz {
          color: #fff;
        }
    .col.col-md-3
      p ref. 
        a(href="https://sass-lang.com/documentation/style-rules/parent-selector#adding-suffixes", target="_blank", rel="noopener", title="Sass documentation | Adding Suffixes") Adding Suffixes
        br
        small.text-mute note. before v.3.3 ? 
          span.text-danger compile error
          
      pre.code.
        .foo
          &__bar
            color: #000
          &--baz
            color: #fff
      p.bold result
      pre.code.
        .foo__bar {
          color: #000;
        }
        .foo--baz {
          color: #fff;
        }
      
    
              
            
!

CSS

              
                .foo
  #{&}__bar
    color: #000
  #{&}--baz
    color: #fff
// .foo .foo__bar
// .foo .foo--baz

/* <= v3.3 @at-root #{&}... */
.foo
  @at-root
    #{&}__bar
      color: #000
  @at-root
    #{&}--baz
      color: #fff
// .foo__bar
// .foo--baz

/* <= v3.3 @at-root &... */
.foo
  @at-root
    &__bar
      color: #000
  @at-root
    &--baz
      color: #fff

// like stylus
.foo
  &__bar
    color: #000
  &--baz
    color: #fff
// .foo__bar
// .foo--baz

.bold
  font-weight: 600

pre.code
  padding: .5em
  background-color: #F0F0F0
  border-radius: .3em
 
/*--- #{&} --- */
.block
  #{&}__element
    color: #333
    #{&}--modifier
      color: #444
/* compile */
/* .block .block__element { ... }
/* .block .block__element .block .block__element--modifier { ... } 

/*--- @at-root + #{&} --- */
.block
  @at-root
    #{&}__element
      color: #333
      @at-root
        #{&}--modifier
          color: #444
/* compile */
/* .block__element { ... }
/* .block__element--modifier { ... }
              
            
!

JS

              
                
              
            
!
999px

Console