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

              
                
<header>
	<h1>CSS Attribute selectors</h1>
	<p>There is no class on this h1... so why is it green...</p>
</header>

<div class="test-one">
	test- if the class by itself
</div>

<p class="bla-bla test-two">
	testing if there are many classes and the test- is last
</p>

<header class="bla-bla test-butt example">
	testing if there are many classes and the test- is in the middle
</header>

<section>

	<ul>
		<li class='thing-test'>testing -test</li>
		<li class='test-list-item'>Test list item.</li>
		<li></li>
	</ul>

</section>



<h3>On another note...</h3>
<!--
I DONT WANT ANY ID's used for styling - only JS... so - if an id isn't prefixed with js-, then make this ugly warning to remind people they be wrong.
-->
<div id="test">
	test ID ALERT... Caught you!!! don't style with IDs silly...
</div>

<div id="js-test">
	test ID with js- prefix... if you use an ID for JavaScript - then great!, but how can you be sure that some other developer will not style with them?
	<br>
	<br>
	'rel' and 'data-x' don't seem like the right place... 
</div>

              
            
!

CSS

              
                
// (anything with the class attribute)
[class]
	color: green

// anything with a class containing this string
[class*='test-']
	color: blue

// select IDs that do not have the js- prefix
[id]:not([id*='js-']) {
	outline: 1px dotted red	!important
	color: red !important
	background: white !important
	padding: .5rem !important
} // I never use outlines anywhere - so this should override anything...












              
            
!

JS

              
                
              
            
!
999px

Console