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

              
                .example
  .example__content
    %h1 Hello World!
    %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Obcaecati incidunt non nam quasi mollitia recusandae harum deleniti hic.

              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Montserrat:400,700')

$image_url: 'https://unsplash.it/g/1280/800/?random'

@mixin background_overlay($image_url: null, $solid_background: null, $gradient_start: null, $gradient_end: null, $gradient_direction: null)
  $g: linear-gradient(if($gradient_direction == null, null, $gradient_direction + unquote(',')) if($gradient_start == null, transparent, $gradient_start), if($gradient_end == null, transparent, $gradient_end))
  $s: linear-gradient($solid_background 100%, transparent)
  $i: url($image_url)
  
  @if ($gradient_start == null) and ($gradient_end == null)
    $g: null
  @if $solid_background == null
    $s: null
  @if $image_url == null
    $i: null

  background-image: $g, $s, $i

// Tests
.test
  +background_overlay($image_url: null, $solid_background: null, $gradient_start: '$gradient_start', $gradient_end: '$gradient_end', $gradient_direction: '$gradient_direction')
  +background_overlay($image_url: null, $solid_background: null, $gradient_start: '$gradient_start', $gradient_end: '$gradient_end', $gradient_direction: null)
  +background_overlay($image_url: null, $solid_background: null, $gradient_start: null, $gradient_end: '$gradient_end', $gradient_direction: null)
  +background_overlay($image_url: null, $solid_background: null, $gradient_start: '$gradient_start', $gradient_end: null, $gradient_direction: null)
  +background_overlay($image_url: null, $solid_background: '$solid_background', $gradient_start: null, $gradient_end: null, $gradient_direction: null)
  +background_overlay($image_url: '$image_url', $solid_background: null, $gradient_start: null, $gradient_end: null, $gradient_direction: null)

html
  box-sizing: border-box
  -webkit-font-smoothing: antialiased

*, *:before, *:after
  box-sizing: inherit

.example
  $font_size: 20px
  $line_height: $font_size * 1.5

  // Use it to add a solid overlay to make text more readable on images
  +background_overlay($image_url, rgba(black, 0.25))
  // Use it to add both solid and gradient overlays on images
  +background_overlay($image_url, rgba(blue, 0.25), rgba(blue, 0.5), rgba(red, 0.75), to top right)

  position: relative
  height: 100vh
  background-size: cover
  background-position: center
  color: white
  font-family: 'Montserrat', sans-serif
  font-size: $font_size
  line-height: $line_height

  &__content
    position: absolute
    top: 50%
    left: 50%
    width: 100%
    max-width: $line_height * 20
    padding: 0 $line_height
    text-align: center
    transform: translate(-50%, 0)
    opacity: 0
    animation: 0.75s 0.75s forwards slide_in

    @at-root
      @keyframes slide_in
        100%
          transform: translate(-50%, -50%)
          opacity: 1

  h1, p
    margin: $line_height 0

  h1
    font-size: $font_size * 2
    line-height: $line_height * 2
    letter-spacing: $font_size / 2
    text-transform: uppercase

    &:after
      $height: $line_height / 8
      content: ''
      display: block
      width: $line_height * 4
      height: $height
      margin: #{$line_height - $height / 2} auto #{0 - $height / 2}
      background-color: currentColor

              
            
!

JS

              
                
              
            
!
999px

Console