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 is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.


                .diagram(style=`--in0: 0; --in1: 0`)
	input#in0(type='checkbox' aria-label='XOR input')
	label(for='in0' aria-hidden='true' style=`--in: var(--in0)`)
	input#in1(type='checkbox' aria-label='XOR input')
	label(for='in1' aria-hidden='true' style=`--in: var(--in1)`)
	.box(aria-label='operation black box') XOR
	output(for='in0 in1' aria-label='XOR operation result')


                $theme-c: #95a;

.diagram {
	--dif: calc(var(--in0) - var(--in1));
	--xor: calc(var(--dif)*var(--dif));
	--notxor: calc(1 - var(--xor));
	display: grid;
	grid-gap: 1em;
	grid-template: #{2em 2em}/ #{5em 5em 2em};
	grid-auto-flow: column;
	place-content: center;
	font: 2em/ 1.25 ubuntu mono, consolas, monaco, monospace;

input, label { grid-column: 1 }

input {
	position: absolute;
	opacity: 0;
	&:checked + * { --on: 1 }

label {
	--on: 0;
	--notin: calc(1 - var(--in));
	position: relative;
	place-self: center;
	width: 2em; height: 1em;
		linear-gradient($theme-c, $theme-c) calc(var(--on)*100%)/ 1em no-repeat
	transition: .35s ease-out;

	&::before, &::after {
		--i: 0;
		--noti: calc(1 - var(--i));
		--res: calc(var(--i)*var(--notin) + var(--noti)*var(--in));
		display: grid;
		place-content: center;
		position: absolute;
		left: calc(var(--i)*100%);
		width: 1em; height: 1em;
		transform: translate(calc(var(--noti)*-100%));
		color: $theme-c;
		filter: Grayscale(var(--res)) Brightness(calc(1 + var(--res)));
		font: 1em, ubuntu mono, consolas, monaco, monospace;
		transition: inherit;
		counter-reset: i var(--i);
		content: counter(i)

	&::after { --i: 1 }

.box, output { grid-row: 1/ span 2 }

.box {
	display: grid;
	place-content: center;
	position: relative;
	width: 5em; height: 5em;
	box-shadow: inset 0 0 0 2px;

	&::before, &::after {
		position: absolute;
		width: 1em;
		content: ''

	&::before {
		top: calc(1em - 2px); right: 100%;
		border: solid 0 #000;
		border-width: 4px 0;
		height: calc(3em - 4px)

	&::after {
		top: calc(2.5em - 2px); left: 100%;
		height: 4px;
		background: #000;

output {
	place-self: center;
	width: 1.25em;
	border-radius: 5px;
	box-shadow: 0 0 0 2px currentcolor;
	color: #f90;
	text-align: center;

	&::after {
		counter-reset: xor var(--xor);
		content: counter(xor)


                addEventListener('input', e => {
	const _TG =;`--${}`, 1*_TG.checked);