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

              
                <form>
  <select class="form-element" name="css-style" id="style-selection">
    <option value="background-color">Background Color</option>
    <option value="border-color">Border Color</option>
  </select>
  <input class="form-element" id="color-input" type="text" placeholder="Enter Color..."/>
  <button type="button" class="form-element" id="change-button">Apply Change!</button>
</form>

              
            
!

CSS

              
                form {
  display: flex;
  justify-content: center;
  align-items: center;
  border: 10px solid black;
}

.form-element {
  padding: 5px;
  font-size: 16px;
  width: 200px;
  margin: 10px;
}
              
            
!

JS

              
                var formBox = document.querySelector('form');
var styleSelection = document.getElementById('style-selection');
var colorInput = document.getElementById('color-input');
var changeButton = document.getElementById('change-button');

changeButton.addEventListener('click', function() {
  // formBox.style[styleSelection.value] = colorInput.value;
  // formBox.style.styleSelection.value = colorInput.value;
})

// Answer these questions:
// 1. Uncomment line 7 - Is the app working?
// 2. Comment out line 7 and uncomment line 8 - Is the app working?
// 3. Using your knowledge of bracket vs. dot notation, why do you think this happened?
// 4. What assumptions can you make about the style object in javascript?
              
            
!
999px

Console