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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import or require. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              点击 A 块时,A 获得了蓝色背景,同时,因为 A 的内联样式,使得 B 块满足 p[style] + p,B 块应同时获得绿色背景。然而,在 Chrome 中测试,B 块并无变化。这时,点击 B 块,B 块获得黄色边框,绿色背景和黄色边框同时出现。由此,可知 Chrome 存在一重绘 bug,对比测试显示,Firefox 并无此 bug
<p id="A">A</p>
<p id="B">B</p>

            
          
!
            
              p {
	width:800px;
	height:150px;
	margin:10px auto;
	border:5px solid red;
}

p[style] + p {
	background:green;
}

            
          
!
            
              self.A.onclick = () => self.A.style = 'background:blue';
self.B.onclick = () => self.B.style = 'border:5px solid yellow';

            
          
!
999px

Console