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

              
                #data1 #data1: HTML に独自データ属性を持たない
#data2(data-theme="Custom data attribute") #data2: HTML に独自データ属性を設定する
#data3(data-theme="Custom data attribute") #data3: HTML に独自データ属性を設定する

              
            
!

CSS

              
                body { padding: 1rem; }

              
            
!

JS

              
                // jQuery v.2.2.4

// #data1 要素に data-xxx 属性 が設定されたわけではないことが確認できる。
console.log('#data1 --------');
$('#data1').data('theme', 'reference');
console.log($('#data1').data('theme')); // reference
$('#data1').data('theme', 'Set data method');
console.log($('#data1').data('theme')); // Set data method
console.log($('#data1').attr('data-theme')); // undifined

// #data2 要素の data-xxx 属性 は data() メソッドで書き換わっていない。
console.log('#data2 --------');
$('#data2').data('theme', 'reference');
console.log($('#data2').data('theme')); // reference
$('#data2').data('theme', 'Set data method');
console.log($('#data2').data('theme')); // Set data method
console.log($('#data2').attr('data-theme')); // Custom data attribute

// #data3 要素の data-xxx 属性 は attr() メソッドで書き換わるが、data は変わっていない。
console.log('#data3 --------');
console.log($('#data3').data('theme')); // Custom data attribute
console.log($('#data3').attr('data-theme')); // Custom data attribute
$('#data3').attr('data-theme', 'Set attr method');
console.log($('#data3').data('theme')); // Custom data attribute
console.log($('#data3').attr('data-theme')); // Set data method

              
            
!
999px

Console