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

              
                <div class="section">
  <h2>Block - button</h2>
  <button class="btn">Default</button>

  <h2>Block - button with modifier</h2>
  <button class="btn btn--primary">Primary button</button>
  <button class="btn btn--secondary">Primary button</button>
</div>

<div class="section">
  <h2>Search component</h2>
  <div class="search">
    <input class="input search__input" type="text">
    <!-- Button block -->
    <span class="search__addon">
      <button class="btn btn--primary search__btn">Search</button>
    </span>
  </div>
</div>
              
            
!

CSS

              
                // Unrelated styles to create some space between components
* { box-sizing: border-box; }
.section { padding: 20px; }

// Some of this styling has been taken from Bootstrap 4 or modified slightly
// https://v4-alpha.getbootstrap.com/components/buttons/

//
// Block - button
//
.btn {
  display: inline-block;
  padding: .375rem 1rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  -ms-touch-action: manipulation;
  touch-action: manipulation;
  cursor: pointer;
  user-select: none;
  border: .0625rem solid transparent;
  border-radius: .25rem;
}

// Modifier - color variations to button block
.btn--primary {
  color: #fff;
  background-color: #0275d8;
  border-color: #0275d8;
}

.btn--secondary {
  color: #373a3c;
  background-color: #fff;
  border-color: #ccc;
}


// Block - input
.input {
  width: 100%;
  padding: .375rem .75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #55595c;
  background-color: #fff;
  background-image: none;
  border: .0625rem solid #ccc;
  border-radius: .25rem;
}

//
// Search component - composed of a button and input
//

// Block - search
.search {
  width: 400px;
  display: table;
  border-collapse: separate;
  position: relative;
}

// Element - input within the search component
// Styling that only applies to inputs when placed in the context of a search component
.search__input {
  display: table-cell;
  position: relative;
  float: left;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

// Element
.search__addon {
  display: table-cell;
  white-space: nowrap;
  vertical-align: middle;
  width: 1%;  
}

// Element - search button
// Styling that only applies to buttons when placed in the context of a search component
.search__btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

              
            
!

JS

              
                
              
            
!
999px

Console