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

              
                <!-- first div -->
<div id="attach1">The background image does not scroll with the scrollable content of the div element and is fixed relative to the element.<br><br>
The background image does not scroll with the scrollable content of the div element and is fixed relative to the element.</div>
<span>background: url('tree.jpg') no-repeat scroll</span>

<!-- second div -->
<div id="attach2">The background image scrolls with the scrollable content of the div element because it is fixed relative to the element's content.<br><br>
The background image scrolls with the scrollable content of the div element because it is fixed relative to the element's content.</div>
<span>background: url('tree.jpg') no-repeat local</span>

<!-- third div -->
<div id="attach3">The background image does not scrolls with the div element or its content and is fixed relative to the viewport.<br><br>
The background image does not scrolls with the div element or its content and is fixed relative to the viewport.</div>
<span>background: url('tree.jpg') no-repeat fixed</span>
              
            
!

CSS

              
                div {
  margin-top: 20px;
  width: 300px;
  height: 152px;
  padding: 20px;     /* padding */ 
  font-family: 'Noto Sans', sans-serif;
  font-size: 20px;
  color: #ddd;
  overflow: auto;
}

span {
  font-family: 'Noto Sans', sans-serif;
  font-size: 17px;
  font-weight: 900;
}

/* giving different values to background-attachment property for different div */

#attach1 {
  background: url('https://www.dl.dropboxusercontent.com/s/u0z91wl2d74p7pt/tree.jpg?dl=0') no-repeat scroll;
}

#attach2 {
  background: url('https://www.dl.dropboxusercontent.com/s/u0z91wl2d74p7pt/tree.jpg?dl=0') no-repeat local;
}

#attach3 {
  background: url('https://www.dl.dropboxusercontent.com/s/u0z91wl2d74p7pt/tree.jpg?dl=0') no-repeat fixed;
}
              
            
!

JS

              
                
              
            
!
999px

Console