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.


                <h1>Selecting Partial Attribute Names</h1>
<h2>using Xpath</h2>

<p>Selecting elements based on partial attribute name match isn't something CSS or JavaScript are equipped to do, but it <em>is</em> something which XPath is able to select fairly easily!</p>
<p>Below we have two examples of tags with custom attribute names, and if we wanted to select them in CSS or JavaScript we would have no way other than using the CSS selector <code>data-custom-1, data-custom-2</code>. But we can only write selectors like this if we know all of the custom attributes that might show up.</p>
<p>By using XPath with the following selector: <code>//*[@*[starts-with(name(), "data-custom-")]]</code> we are able to select all tags whose attributes begin with <code>data-custom-</code></p>

<div data-custom-1>custom 1</div>
<div data-custom-2>custom 2</div>




                var tags = document.evaluate('//*[@*[starts-with(name(), "data-custom-")]]', document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null)

try {

  var node = tags.iterateNext()

  while (node) { = 'black' = 'lime'

    node = tags.iterateNext()


catch (e) {
  console.log('couldn\'t style ' + e)