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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              -
	let pegs = 21;
	let rows = 13;
	let cols = 13;
	
	let i = 0;
	let j = 0;
	let k = 0;
	
while k < pegs
	input(type="radio" class=`peg_${k} peg picker` name="peg" checked=(k===0))
	- k++
	
- k = 0
form#screen
	#board(style=`width: ${(cols+1) * 5.4}vmin; height: ${(rows+1) * 5.4}vmin`)
		button.reset(type="reset")
		while i < rows
			.row
				- j = 0
				while j < ((i % 2 == 0) ? cols : cols+1)
					- k = 0
					.hole(style=`z-index: ${(cols+2) - j}`)
						while k < pegs
							input(type="checkbox" class=`peg_${k} peg`)
							- k++
						.peg-color
					- j++
			- i++

style
	|	.peg_20, #board .peg_20:checked ~ .peg-color { animation: rainbow 10s infinite linear; }
	|	@keyframes rainbow {
	|		0%, 100% { color: #900 }
	|		05.556% { color: #930 } 
	|		11.111% { color: #960 }
	|		16.667% { color: #990 }
	|		22.222% { color: #690 }
	|		27.778% { color: #390 }
	|		33.333% { color: #090 }
	|		38.889% { color: #093 }
	|		44.444% { color: #096 }
	|		50.000% { color: #099 }
	|		55.556% { color: #069 }
	|		61.111% { color: #039 }
	|		66.667% { color: #009 }
	|		72.222% { color: #309 }
	|		77.778% { color: #609 }
	|		83.333% { color: #909 }
	|		88.889% { color: #906 }
	|		94.444% { color: #903 }
	|	}
	
-
	let penfooter = {
		author_id: "seto89",
		author_name: "seto89",
		author_avatar_id: "2463519",
		universal: "KLaMXm",
	}

footer#footer
	#footer__author
		#footer__author__who
			span#footer__author__who--by
			a#footer__author__who--link(href=`https://codepen.io/${penfooter.author_id}` target="_new" style=`--avatar: url(https://s.cdpn.io/profiles/user/${penfooter.author_avatar_id}/80.jpg)`)
				= penfooter.author_name || penfooter.author_id
		#footer__author__follow
			a#footer__author__follow--link(href=`https://codepen.io/${penfooter.author_id}/pen/${penfooter.universal}` target="_new")
            
          
!
            
              html {
	min-height: 100%;
	min-height: 100vh;
	display: flex;
}
body {
	flex: 1;
	text-align: center;
	background: linear-gradient(to bottom, #000 40vmin, #444 95vmin, #000 98vmin);
}
.peg, .peg:before, .peg:after, .peg-color, .reset {
	transition: all .2s;
}

/* Pegs */
.peg {
	-webkit-appearance: none;
		 -moz-appearance: none;
					appearance: none;
	cursor: pointer;
	border-radius: 100%;
	padding: .5vmin;
	margin: 0;
	padding: 0;
	outline: none;
}

/* Pegs from the Picker */
.peg.picker {
	margin: 1vmin .25vmin;
	padding: 1.5vmin;
}

#screen {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 2.5vmin;
	margin: 0;
}
/* The board */
#board {
	display: flex;
	flex-direction: column;
	
	background-color: #222;
	background-image: repeating-linear-gradient(rgba(0, 0, 0, .25) 0%, transparent 1%);
	border-radius: .5vmin;
	border: 1vmin solid #ddd;
	border-image: radial-gradient(circle, #666, #222) 50;
	box-shadow:
		inset .25vmin .25vmin 1vmin #000,
		inset .1vmin .1vmin 1vmin #000,
		inset 0 0 0 .1vmin #000,
		0 0 0 .1vmin rgba(0, 0, 0, .25)
	;
	position: relative;
}
/* Board Shadow */
#board:before {
	content: "";
	background: #000;
	border-radius: 100%;
	filter: blur(2vw);
	width: 125%;
	margin: 0 -7.5vmin;
	height: 3vmin;
	position: absolute;
	bottom: -3vmin;
	z-index: -1;
}
/* Board Edges */
#board:after {
	content: "";
	border-radius: inherit;
	box-shadow: inset .25vmin .5vmin .25vmin rgba(255, 255, 255, .25), inset -.25vmin -.5vmin .25vmin rgba(0, 0, 0, .25);
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1;
	margin: -1vmin; /* Must be the same value as border */
}

/* Buttons */
#board .reset {
	background-color: #222;
	border: .15vmin solid rgba(0, 0, 0, .25);
	box-shadow: inset .25vmin 0vmin .5vmin rgba(255, 255, 255, .25);
	border-radius: 100% 0 0 100%;
	box-sizing: border-box;
	cursor: pointer;
	padding: 10vmin 1vmin;
	position: absolute;
	left: -4.3%;
	outline: none;
}
#board .reset:focus {
	background-color: #333;
}
#board .reset:active {
	margin-left: 1%;
}

/* The board rows and holes */
#board .row {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
}
#board .row .hole {
	background-color: #111;
	border-radius: 100%;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), inset 0 0 2vmin #000;
	margin: 0 .3vmin;
	padding: 2.25vmin;
	position: relative;
}
#board .row .hole:focus-within {
	box-shadow: 0 0 0 1px rgba(255, 255, 255, .5);
}

/* The board pegs */
#board .row .hole .peg,
#board .row .hole .peg-color {
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	position: absolute;
	width: 100%;
	height: 100%;
}
#board .row .hole .peg-color {
	border-radius: 100%;
	z-index: 0;
}

/* Selected peg, plugged peg */
.peg_0 , #board .peg_0:checked ~ .peg-color { color: #900; }
.peg_1 , #board .peg_1:checked ~ .peg-color { color: #930; }
.peg_2 , #board .peg_2:checked ~ .peg-color { color: #960; }
.peg_3 , #board .peg_3:checked ~ .peg-color { color: #990; }
.peg_4 , #board .peg_4:checked ~ .peg-color { color: #690; }
.peg_5 , #board .peg_5:checked ~ .peg-color { color: #390; }
.peg_6 , #board .peg_6:checked ~ .peg-color { color: #090; }
.peg_7 , #board .peg_7:checked ~ .peg-color { color: #093; }
.peg_8 , #board .peg_8:checked ~ .peg-color { color: #096; }
.peg_9 , #board .peg_9:checked ~ .peg-color { color: #099; }
.peg_10, #board .peg_10:checked ~ .peg-color { color: #069; }
.peg_11, #board .peg_11:checked ~ .peg-color { color: #039; }
.peg_12, #board .peg_12:checked ~ .peg-color { color: #009; }
.peg_13, #board .peg_13:checked ~ .peg-color { color: #309; }
.peg_14, #board .peg_14:checked ~ .peg-color { color: #609; }
.peg_15, #board .peg_15:checked ~ .peg-color { color: #909; }
.peg_16, #board .peg_16:checked ~ .peg-color { color: #906; }
.peg_17, #board .peg_17:checked ~ .peg-color { color: #903; }
.peg_18, #board .peg_18:checked ~ .peg-color { color: #999; }
.peg_19, #board .peg_19:checked ~ .peg-color { color: #444; }

.peg.picker,
#board .peg:checked ~ .peg-color {
	background-color: currentcolor;
	background-image:
		radial-gradient(circle, rgba(255, 255, 255, .25), transparent),
		radial-gradient(circle, rgba(255, 255, 255, .75), transparent);
	background-blend-mode: hard-light, color-dodge;
	border: .1vmin solid currentcolor;
	box-sizing: border-box;
}
.peg.picker:checked {
	box-shadow: 0 0 1vmin .25vmin currentcolor, inset 0 0 0 .1vmin rgba(255, 255, 255, .25);
	filter: brightness(120%);
	transform: scale(1.25);
}
#board .peg:checked ~ .peg-color {
	box-shadow: inset 0 0 0 .1vmin rgba(255, 255, 255, .25);
}
#board .peg:focus ~ .peg-color {
	transform: scale(1.25);
}
#board .peg:checked ~ .peg-color:after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	border-radius: 100%;
	box-shadow: 0 0 5vmin 1vmin currentcolor, 0 0 1.5vmin #fff;
	z-index: 1;
	mix-blend-mode: color-dodge;
}

#board .peg {
	display: none;
}
.peg_0.picker:checked ~ #screen #board .peg.peg_0,
.peg_1.picker:checked ~ #screen #board .peg.peg_1,
.peg_2.picker:checked ~ #screen #board .peg.peg_2,
.peg_3.picker:checked ~ #screen #board .peg.peg_3,
.peg_4.picker:checked ~ #screen #board .peg.peg_4,
.peg_5.picker:checked ~ #screen #board .peg.peg_5,
.peg_6.picker:checked ~ #screen #board .peg.peg_6,
.peg_7.picker:checked ~ #screen #board .peg.peg_7,
.peg_8.picker:checked ~ #screen #board .peg.peg_8,
.peg_9.picker:checked ~ #screen #board .peg.peg_9,
.peg_10.picker:checked ~ #screen #board .peg.peg_10,
.peg_11.picker:checked ~ #screen #board .peg.peg_11,
.peg_12.picker:checked ~ #screen #board .peg.peg_12,
.peg_13.picker:checked ~ #screen #board .peg.peg_13,
.peg_14.picker:checked ~ #screen #board .peg.peg_14,
.peg_15.picker:checked ~ #screen #board .peg.peg_15,
.peg_16.picker:checked ~ #screen #board .peg.peg_16,
.peg_17.picker:checked ~ #screen #board .peg.peg_17,
.peg_18.picker:checked ~ #screen #board .peg.peg_18,
.peg_19.picker:checked ~ #screen #board .peg.peg_19,
.peg_20.picker:checked ~ #screen #board .peg.peg_20,
#board .peg:checked {
	display: block;
	z-index: 1;
}
#board .peg:checked {
	z-index: 2;
}

#footer {
	text-align: left;
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console