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

              
                <img
	src="https://www.mozilla.org/apple-touch-icon.png"
	width="200"
	height="200"
	alt="Mozilla"
>
<input
	type="range"
	value="200"
	min="1"
	max="400"
	aria-label="Image size"
>
<button type="button">Reset</button>
              
            
!

CSS

              
                @layer base, squircle;

@layer squircle {
	img {
		border-radius: 22%;
	}

	/* clipping with a fixed path */
	@supports (
		(clip-path: path("M0 0 Z")) and
			(not (clip-path: shape(from 0 0, move to 0 0)))
	) {
		img {
			border-radius: initial;
			clip-path: path(
				"M100,200c43.8,0,68.2,0,84.1-15.9C200,168.2,200,143.8,200,100s0-68.2-15.9-84.1C168.2,0,143.8,0,100,0S31.8,0,15.9,15.9C0,31.8,0,56.2,0,100s0,68.2,15.9,84.1C31.8,200,56.2,200,100,200z"
			);
		}
	}

	/* clipping with a responsive shape */
	@supports (clip-path: shape(from 0 0, move to 0 0)) {
		img {
			border-radius: initial;
			clip-path: shape(
				from 50% 100%,
				curve to 92% 92% with 72% 100% / 84% 100%,
				curve to 100% 50% with 100% 84% / 100% 72%,
				curve to 92% 8% with 100% 28% / 100% 16%,
				curve to 50% 0% with 84% 0% / 72% 0%,
				curve to 8% 8% with 28% 0% / 16% 0%,
				curve to 0% 50% with 0% 16% / 0% 28%,
				curve to 8% 92% with 0% 72% / 0% 84%,
				curve to 50% 100% with 16% 100% / 28% 100%,
				close
			);
		}
	}
}

@layer base {
	body {
		display: grid;
		grid-template-rows: 1fr repeat(2, max-content);
		gap: 1lh;
		place-items: center;
		margin: 0;
		padding: 1lh;
		block-size: calc(100vh - 2lh);
		background-color: mediumseagreen;
	}
	
	input {
		inline-size: 200px;
	}
}

              
            
!

JS

              
                const img = document.querySelector("img");
const input = document.querySelector("input");
const button = document.querySelector("button");

input.addEventListener("input", event => {
	const {value} = event.currentTarget;
	img.width = value;
	img.height = value;
});

button.addEventListener("click", () => {
	input.value = input.defaultValue;
	img.width = input.defaultValue;
	img.height = input.defaultValue;
});
              
            
!
999px

Console