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

              
                - colors = ['#0B0B0D', '#734F71', '#A74573', '#DB5E80', '#F27D73', '#F4F1F4']

h1.heading
	| Palette 
	small 30'

.palette30
	each val in colors
		.color(data-color=val, data-clipboard-text=val): span

.copied
              
            
!

CSS

              
                body
	font-family 'Open Sans', sans-serif
	display flex
	flex-direction column
	align-items center
	justify-content center
	min-height 100vh

.heading
	font-size 50px
	font-weight 900
	margin-bottom 20px
	small
		font-weight 300
	
.palette30
	margin 20px
	display flex
	overflow hidden
	width 700px
	height 50vh
	box-shadow 0 1px 3px rgba(#000, .12), 0 1px 2px rgba(#000, .24)
	border-radius 5px
	
.color
	flex 1 0 auto
	position relative
	cursor pointer
	transition opacity .2s ease-in
	&:first-child
		border-radius 5px 0 0 5px
	&:lasr-child
		border-radius 0 5px 5px 0
	&:after
		content ''
		position absolute
		top 0
		right 0
		bottom 0
		left 0
		background-color #000
		opacity 0
		transition opacity .3s ease-out
		
	span
		transform translateY(200%)
		position absolute
		font-weight 700
		text-align center
		bottom 10px
		left 0
		right 0
		transition transform .2s ease-out
	&:hover
		opacity .85
	&:hover span
		transform translateY(0)
	&:active:after
		opacity .2

.copied
	position absolute
	top 0
	right 0
	bottom 0
	left 0
	background-color rgba(#000, .7)
	color #FFF
	font-size 50px
	font-weight 900
	text-transform uppercase
	user-select none
	display none
	&:after
		content 'Copied!'
		position absolute
		top 50%
		left 50%
		transform translate(-50%)
              
            
!

JS

              
                $(".color").each(function(){
	var color = $(this).data('color');
	$(this)
		.css('background', color)
		.find('span').text(color);
});

var clipboard = new Clipboard('.color');

clipboard.on('success', function(e) {
	$('.copied')
		.fadeIn(200)
		.delay(300)
		.fadeOut(200);
	// alert(e.text);
	e.clearSelection();
});
clipboard.on('error', function(e) {
	alert('Safari not supported :/');
});
              
            
!
999px

Console