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

              
                
input#one(type='radio' name='nav' value='one' checked)
label(for='one') Item one
.item.one
	.wrap
		.content
			h1 Swapping content panels with pure CSS
			p Clicking on one of the radio button labels above will change the displayed content panel.
			p Go ahead and try it!

input#two(type='radio' name='nav' value='two')
label(for='two') Item two
.item.two
	.wrap
		.content
			h1 This is the second item
			p Nice one! As you can see by selecting another radio button option it has changed the slide.
			p This works by using the + adjacent CSS selector

input#three(type='radio' name='nav' value='three')
label(for='three') Item three
.item.three
	.wrap
		.content
			h1 This is the third item
			p The selection of the current "active" label and slide is achieved by chaining the + adjacent selectors.
			p Cool huh?
			p The with a little bit of CSS transition stuff going on it makes it all look pretty neat.
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700");

body {
	font-size:1em;
	font-family:"Open Sans", sans-serif;
}

.item {
	display:inline-block;
	position:absolute;
	top:0; bottom:0; left:0;
	width:0;
	text-align:center;
	overflow:hidden;
	transition:all 1s ease-in-out;
	
	&.one {
		background:pink;
	}
	
	&.two {
		background:palegreen;
	}
	
	&.three {
		background:teal;
	}
	
	.wrap {
		width:100vw;
		
		.content {
			padding:50px;			
			color:#fff;
			text-shadow:1px 1px rgba(0,0,0,0.5);
			font-size:1.3em;
		}
	}
}

input, label {
	position:relative;
	z-index:5000;
	background:#fff;
	display:inline-block;
}

label {
	padding:5px 10px;
	cursor:pointer;
	
	&:hover {
		background:#eee;
	}
}

input {	
	display:none;
	
	&:checked {
		+ label {
			background:palevioletred;
			color:#fff;
			
			+ .item {
				width:100%;
				transition:all 1s ease-in-out;
				z-index:1000;
			}
		}
	}
}
              
            
!

JS

              
                // Purely for automatically demoing in the CodePen preview :) 
setTimeout(function() {
	$('#two').prop('checked', true);
	
	setTimeout(function() {
		$('#three').prop('checked', true);
		
		setTimeout(function() {
			$('#one').prop('checked', true);
			// Go back to the begining.
		},3000)		
	},2000)
},1000)
              
            
!
999px

Console