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

              
                .content
  section
    h2 Lorem, ipsum
    img(src='https://images.unsplash.com/photo-1472491235688-bdc81a63246e?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ' alt='')
    p Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.
    
  section.bigger
    h2 Donec pede
    p Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus.
    
  .m-lg.helper helper
  .m-sm--b.helper helper
  .p-df.helper helper
  .p-md--v.helper helper

              
            
!

CSS

              
                
$breakpoint-xs: 0;
$breakpoint-sm: 576px;
$breakpoint-md: 768px;
$breakpoint-lg: 992px;
$breakpoint-xl: 1200px;
$fluid-space-unit: 1em;
$fixed-space-unit: 1rem;

:root {
  --space-unit: #{$fluid-space-unit}; /* 16px */
  --space-xxs:  calc(0.25 * var(--space-unit));
  --space-xs:   calc(0.5 * var(--space-unit));
  --space-sm:   calc(0.75 * var(--space-unit));
  --space-df: var(--space-unit);
  --space-md:   calc(1.25 * var(--space-unit));
  --space-lg:   calc(2 * var(--space-unit));
  --space-xl:   calc(3.25 * var(--space-unit));
  --space-xxl:  calc(5.25 * var(--space-unit));
  
  --space-unit-fixed: $fixed-space-unit;
  --space-xxs-fixed:  calc(0.25 * var(--space-unit-fixed));
  --space-xs-fixed:   calc(0.5 * var(--space-unit-fixed));
  --space-sm-fixed:   calc(0.75 * var(--space-unit-fixed));
  --space-md-fixed:   calc(1.25 * var(--space-unit-fixed));
  --space-lg-fixed:   calc(2 * var(--space-unit-fixed));
  --space-xl-fixed:   calc(3.25 * var(--space-unit-fixed));
  --space-xxl-fixed:  calc(5.25 * var(--space-unit-fixed));
  
  --section-padding: var(--space-lg);
}

// helper自動生成するやつ
$spacer-prefix: '';
$spacer-type: (m, margin), (p, padding);
$spacer-size: xxs, xs, sm, df, md, lg, xl, xxl, 0;
$spacer-position-name: (t, top), (r, right), (b, bottom), (l, left), (v, top, bottom), (h, left, right);
$spacer-separator: '-';
$spacer-modifier: '--';

@each $type in $spacer-type {
  $p: nth($type, 1); //m, p
  $spacer-type-fill: nth($type, 2); //margin, padding

  @each $size in $spacer-size {

    .#{$spacer-prefix}#{$p}#{$spacer-separator}#{$size} { //.m-xxs .p-xs
      #{$spacer-type-fill}: var(--space-#{$size}) !important;
    }

    @each $name in $spacer-position-name {

      $n: nth($name, 1);

      .#{$spacer-prefix}#{$p}#{$spacer-separator}#{$size}#{$spacer-modifier}#{$n} { //.m-xxs--v

        @for $i from 2 through length($name) {
          //margin-bottom: ...
          #{$spacer-type-fill}-#{nth($name, $i)}: var(--space-#{$size}) !important;
        }
      }
    }
  }
}


.content {
  margin: var(--space-md);
}

section {
  border: solid 1px silver;
  padding: var(--section-padding);
  
  img {
    max-width: 100%;
  }
 
  &.bigger {
    font-size: 1.5rem;
  }
}

section + section {
  margin-top: var(--space-md);
}

.helper {
  background: #BA68C8;
  border: solid 1px;
}

@media (max-width: $breakpoint-sm) {
  :root {
    --space-unit: #{$fluid-space-unit / 2};
  }
} 
@media (min-width: $breakpoint-lg) {
  :root {
    --space-unit: #{$fluid-space-unit * 2};
  }
} 
              
            
!

JS

              
                
              
            
!
999px

Console