Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <div id="ost-container">
  <h3>Repeated Background</h3>
  <div class="bg-div backrepeat"></div>
  <br />
  <h3>Center Position Background</h3>
  <div class="bg-div backposcenter"></div>
  <br />
  <h3>Top Right Background</h3>
  <div class="bg-div backpos"></div>
  <br />
  <h3>Banner Background</h3>
  <div class="bg-div backbanner"></div>
  <br />
  <h3>Shorthand Banner Background</h3>
  <div class="bg-div backshorthand"></div>
  <br />
  <h3>Fixed Background</h3>
  <div class="bg-div backfixed"></div>
  <br />
  <!-- This is just to add spacing to show off background-attachment: fixed -->
  <div class="fill-div"></div>
</div>
              
            
!

CSS

              
                /* Not relevant to the lesson. Just setting up a parent div with a max width. */
#ost-container{
  max-width: 870px;
  margin: 0 auto;
}
h3{
  text-align: center;
}
.bg-div{
  width: 100%;
  height: 300px;
}
.fill-div{
  height: 1000px;
}

/* OST Lesson Styling */
.backrepeat{
  background-image: url("https://www.ostraining.com/cdn/images/blog/coding/backgroundimages/backrepeat.png");
}
.backposcenter{
  background-color: #fcfcfc;
  background-image: url("https://www.ostraining.com/cdn/images/blog/coding/backgroundimages/backposcenter.png");
  background-repeat: no-repeat;
  background-position: center center;
}
.backpos{
  background-color: #fcfcfc;
  background-image: url("https://www.ostraining.com/cdn/images/blog/coding/backgroundimages/backpos.png");
  background-repeat: no-repeat;
  background-position: top right;
}
.backbanner{
  background-image: url("https://www.ostraining.com/cdn/images/blog/coding/backgroundimages/backbanner.png");
  background-repeat: no-repeat;
  background-position: top left;
}
.backshorthand{
  background: url("https://www.ostraining.com/cdn/images/blog/coding/backgroundimages/backshorthand.png") no-repeat top left;
}
.backfixed{
  background: url("https://www.ostraining.com/cdn/images/blog/coding/backgroundimages/backfixed.png") no-repeat top left;
  background-attachment: fixed;
  background-size: cover;
}
              
            
!

JS

              
                
              
            
!
999px

Console