Pen Settings



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


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.


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.


	<button data-after-text="5" data-after-type="red badge top left" type="button">red badge top left</button>
	<button data-after-text="5" data-after-type="badge top right" type="button">badge top right</button>
	<button data-after-text="5" data-after-type="darkgray badge bottom left" type="button">darkgray badge bottom left</button>
	<button data-after-text="5" data-after-type="orange badge bottom right" type="button">orange badge bottom right</button>
	<button data-after-text="5" data-after-type="red badge top right" data-before-text="new" data-before-type="blue pill" type="button">blue pill + red badge top right</button>
	<button data-after-text="5" data-after-type="red badge bottom right" data-before-text="12" data-before-type="blue badge top right" type="button">dual badges</button>

<h1 data-before-text="New" data-before-type="circle">circle</h1>
<h2 data-before-text="New" data-before-type="darkgray circle">darkgray circle</h2>
<h3 data-before-text="New" data-before-type="lightgray circle">lightgray circle</h3>
<span data-before-text="New" data-before-type="green circle">green circle</span>
<span data-after-text="New" data-after-type="blue circle">blue circle after text</span>

<span data-before-text="1" data-before-type="green dot">In Stock</span>, but it could be  <span data-before-text="1" data-before-type="red dot">Out of Stock</span>, or even <span data-before-text="1" data-before-type="orange dot">Temporarily Out of Stock</span>

	<button data-after-text="5" data-after-type="blue dot top left" type="button">blue dot top left</button>
	<button data-after-text="5" data-after-type="red dot top right" type="button">red dot top right</button>
	<button data-after-text="5" data-after-type="green dot bottom left" type="button">green dot bottom left</button>
	<button data-after-text="5" data-after-type="red dot bottom right" type="button">red dot bottom right</button>

<span data-before-text="before" data-before-type="blue pill">Exiting new item. </span>
<span data-after-text="after" data-after-type="red pill">Exiting new item</span>
<span data-before-text="before" data-before-type="lightgray pill">Exiting new item</span>


[data-before-text] {
	--badge-offset-x: calc(0px - var(--badge-size) / 3);
	--badge-offset-y: calc(0px - var(--badge-size) / 3);
	--badge-size: 1.5rem;
	--circle-size: 2rem;
	--dot-offset: 0.5rem;
	--dot-size: 0.5rem;
	--b: initial;
	--bgc: hsl(195, 100%, 30%);
	--bdrs: 0;
	--c: hsl(195, 100%, 99%);
	--d: inline-flex;
	--fz: 0.625rem;
	--fw: 700;
	--h: auto;
	--l: initial;
	--m: 0.4rem;
	--p: 0;
	--pos: static;
	--r: initial;
	--t: initial;
	--tt: uppercase;
	--w: initial;
	position: relative;

[data-after-text]:not([data-after-text=""])::after {
	content: attr(data-after-text);
[data-before-text]:not([data-before-text=""])::before {
	content: attr(data-before-text);

[data-before-text]:not([data-before-text=""])::before {
	align-items: center;
	background: var(--bgc);
	border-radius: var(--bdrs);
	bottom: var(--b);
	box-shadow: var(--bxsh);
	box-sizing: border-box;
	color: var(--c);
	display: var(--d);
	font-size: var(--fz);
	font-weight: var(--fw);
	height: var(--h);
	justify-content: center;
	left: var(--l);
	padding: var(--p);
	position: var(--pos);
	right: var(--r);
	text-decoration: none;
	text-transform: var(--tt);
	top: var(--t);
	width: var(--w);

[data-before-type*="badge"]::before {
	--bdrs: var(--badge-size);
	--bxsh: 0 0 0 2px rgba(255, 255, 255, 0.5);
	--h: var(--badge-size);
	--p: 0;
	--pos: absolute;
	--w: var(--badge-size);
	align-items: center;
	display: flex;
[data-before-type*="circle"]::before {
	--bdrs: 50%;
	--fw: 400;
	--h: var(--circle-size);
	// --pos: relative;
	// --t: -0.75em;
	--tt: initial;
	--w: var(--circle-size);
[data-after-type*="pill"]::after {
	margin-inline-start: 1ch;
[data-before-type*="pill"]::before {
	margin-inline-end: 1ch;
[data-before-type*="dot"]::before {
	--bdrs: 50%;
	--d: inline-block;
	--fz: 50%;
	--h: var(--dot-size);
	--p: 0;
	--pos: relative;
	--t: -1px;
	--w: var(--dot-size);
[data-before-type*="dot"]::before {
	content: "" !important;
[data-before-type*="pil"]::before {
	--bdrs: 1rem;
	--p: 0.25rem 0.75rem;
	--pos: relative;
	--t: -1px;

/* COLORS */
[data-before-type*="blue"]::before {
	--bgc: #007acc;
[data-before-type*="darkgray"]::before {
	--bgc: #706e6b;
	--c: #fff;
[data-before-type*="green"]::before {
	--bgc: #04844b;
[data-before-type*="lightgray"]::before {
	--bgc: #ecebea;
	--c: #080707;
[data-before-type*="orange"]::before {
	--bgc: #ffb75d;
	--c: #080707;

[data-before-type*="red"]::before {
	--bgc: #c23934;

[data-before-type*="top"]::before {
	--b: auto;
	--pos: absolute;
	--t: var(--dot-offset);
[data-before-type*="right"]::before {
	--l: auto;
	--pos: absolute;
	--r: var(--dot-offset);
[data-before-type*="bottom"]::before {
	--b: var(--dot-offset);
	--pos: absolute;
	--t: auto;
[data-before-type*="left"]::before {
	--pos: absolute;
	--r: auto;
	--l: var(--dot-offset);
[data-before-type*="badge"][data-before-type*="top"]::before {
	--m: 0;
	--t: var(--badge-offset-y);
[data-before-type*="badge"][data-before-type*="right"]::before {
	--m: 0;
	--r: var(--badge-offset-x);
[data-before-type*="badge"][data-before-type*="bottom"]::before {
	--b: var(--badge-offset-y);
	--m: 0;
[data-before-type*="badge"][data-before-type*="left"]::before {
	--l: var(--badge-offset-x);
	--m: 0;

/* For this demo only */
body { font-family: system-ui, sans-serif; font-size: 1rem; padding: 1rem; }
button {
	background-image: linear-gradient(34deg, hsl(195, 25%, 80%), hsl(195, 25%, 90%));
	border: 0;
	border-radius: .25rem;
	font-size: 1rem;
	margin: 0.5rem 0.5rem 0.5rem 0;
	padding: 0.75rem 1.5rem;