Pen Settings



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


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


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.


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.


                <div id="main-bg"></div>
<form class="container">
  <ul id="bg-opts" class="row">
    <li class="bg-opt-item span4">
      <p class="lead text-info">Background Size</p>
      <div class="bg-opt-radios">
        <p><label for="bg_size_cover" class="radio"><input type="radio" name="bg_size" value="cover" id="bg_size_cover" checked /> Cover</label></p>
        <p><label for="bg_size_contain" class="radio"><input type="radio" name="bg_size" value="contain" id="bg_size_contain" /> Contain</label></p>
        <p><label for="bg_size_100_auto" class="radio"><input type="radio" name="bg_size" value="100% auto" id="bg_size_100_auto" /> 100% auto</label></p>
        <p><label for="bg_size_auto_100" class="radio"><input type="radio" name="bg_size" value="auto 100%" id="bg_size_auto_100" /> auto 100%</label></p>
        <p><label for="bg_size_100_100" class="radio"><input type="radio" name="bg_size" value="100% 100%" id="bg_size_100_100" /> 100% 100%</label></p>
        <p><label for="bg_size_100px_100px" class="radio"><input type="radio" name="bg_size" value="100px 100px" id="bg_size_100px_100px" /> 100px 100px</label></p>
    <li class="bg-opt-item span4">
      <p class="lead text-info">Background Image</p>
      <div class="bg-opt-radios">
        <p><label for="bg_img_landscape" class="radio"><input type="radio" name="bg_img" value="" id="bg_img_landscape" checked /> Landscape</label></p>
        <p><label for="bg_img_portrait" class="radio"><input type="radio" name="bg_img" value="" id="bg_img_portrait" /> Portrait</label></p>
    <li class="bg-opt-item span4">
      <p class="lead text-info">Background Position</p>
      <div class="bg-opt-radios">
        <p><label for="bg_pos_center" class="radio"><input type="radio" name="bg_pos" value="center" id="bg_pos_center" checked /> Center</label></p>
        <p><label for="bg_pos_lt" class="radio"><input type="radio" name="bg_pos" value="left top" id="bg_pos_lt" /> Left Top</label></p>
        <p><label for="bg_pos_lb" class="radio"><input type="radio" name="bg_pos" value="left bottom" id="bg_pos_lb" /> Left Bottom</label></p>
        <p><label for="bg_pos_rt" class="radio"><input type="radio" name="bg_pos" value="right top" id="bg_pos_rt" /> Right Top</label></p>
        <p><label for="bg_pos_rb" class="radio"><input type="radio" name="bg_pos" value="right bottom" id="bg_pos_rb" /> Right Bottom</label></p>
<div class="container well well-small">
  <span class="muted">Photo by <a href="">Tony Armstrong</a>.</span>


  width: 100%;
  height: 350px;
  margin-bottom: 1.9em;
  background-repeat: no-repeat;
  background-position: center;
  background-image: url(;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  background-size: cover;


  $("input[type=radio]").on("change", function(){
    var $el = $(this),
        $name = $el.attr("name"),
        $value =$el.val(),
        $target = $("#main-bg");
      case "bg_size":
        $target.css("background-size", $value);
      case "bg_img":
        $target.css("background-image", "url("+$value+")");
      case "bg_pos":
        $target.css("background-position", $value);