Pen Settings



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


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


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.


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.


                <h1>Experiments with HTML5</h1>
			<li><a href="">Custom elements</a>. I want a custom-made syntactic html! I want my own tags with behaviour and style!
			<li><a href="">Templates</a>. No more script type="template/x-handlebars-template" hack. Now we have Template html tag.
			<li><a href="">Shadow DOM</a>. Each tile have its own CSS. And the page CSS does not affect the tiles. See the backgounds!
			<li><a href="">Flexbox</a>. I do not want space between the tiles!
			<li><a href="">GSAP</a>. Because I want some animations.

		<template id="tile">
				div {
					border: 3px solid black; 
					width: 256px; height: 256px; 
					background-color: red; }
			<div><img src="" /></div>

		<div id="container">
			<s3f-tile back-image=""></s3f-tile>
			<s3f-tile back-image=""></s3f-tile>
			<s3f-tile back-image=""></s3f-tile>
			<s3f-tile back-image=""></s3f-tile>


                div { background-color: blue !important; }
			#container { 
				display: flex; flex-flow: row wrap; 
				width: 524px; margin: 0 auto;


                var S3fTileProto = Object.create(HTMLElement.prototype);

S3fTileProto.spin = function() {
	// Initiate a spin when it is spinning does not look right.	
	if(this.isSpinning == true) return;
	this.isSpinning = true;

	var $element = $(this.shadowRoot).find("div");
	var $img = $(this.shadowRoot).find("img");
	var showFront = function() { $img.attr("src", this.attr("back-image")); }.bind($(this));
	var showBack = function() { $img.attr("src", ""); };

	TweenLite.set($element, {transformPerspective:500});
	new TimelineLite()
		.fromTo($element, 1, {rotationY: "0deg"}, { rotationY: "90deg", ease: Power1.easeIn, onComplete: showFront })
		.to($element, 1, { rotationY: "180deg", ease: Power1.easeOut })
		.to($element, 1, { rotationY: "270deg", ease: Power1.easeIn, onComplete: showBack })
		.to($element, 1, { rotationY: "360deg", ease: Power1.easeOut, onComplete: function() { this.isSpinning = false }.bind(this) })

S3fTileProto.createdCallback = function() {
	this.addEventListener('click', this.spin);

	var clone = document.importNode($('#tile')[0].content, true);

document.registerElement("s3f-tile", { prototype: S3fTileProto });