Pen Settings

HTML

CSS

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

JavaScript

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

Behavior

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.

HTML

              
                - let w = 400, h = .2*w;
- let d = h, r = .5*d;
- let dw = h, dh = 2*h;
- let vb_w = w + 2*dw, vb_h = h + 2*dh;
- let vb_x = -dw, vb_y = -.5*vb_h;
- let s = .0125*h;
- let val = 35;

.wrap(style=`--val: ${val}; --w: ${w}; --h: ${h}; --dw: ${dw}; --dh: ${dh}`)
	svg(viewBox=[vb_x, vb_y, vb_w, vb_h].join(' ') stroke-width=s)
		marker#s(viewBox='-1 -4 9 8' markerWidth='9' markerHeight='8' refx='')
			path(d=`M0 0 8-4 6 0 8 4`)
		marker#e(viewBox='-2 -4 9 8' markerWidth='9' markerHeight='8' refX='4')
			path(d=`M0 0-2-4 5 0-2 4`)
		path.ml(d=`M${w - r + s} ${2.5*r}h${r - 2*s}M${s} ${2*r}h${r - 2*s}`)
		path.ml(d=`M${r + s} ${2*r}h${w - d - 2*s}`)
		path.ml.uni(d=`M${s} ${3*r}h${w - r - 2*s}`)
		path.ml(d=`M${s}${-4*r}h${w - 2*s}`)
		path.ml.mov(d=`M${s}${-3*r}h${d - 2*s}`)
		path.ml.mov.uni(d=`M${r + s}${-2*r}h${r - 2*s}`)
		path.gl(d=`M0${-4.25*r}V${3.25*r}M${w}${-4.25*r}V${3.25*r}M${r} 0V${2.25*r}M${w - r} 0V${3.25*r}`)
		path.gl.mov(d=`M0${-3.25*r}V0M${r}${-2.25*r}V0M${d}${-3.25*r}V0`)
		path.ol.fix(d=`M0${-r}h${w}v${h}h${-w}zM${-s} ${.8*r}q${-r} 0${-r} ${-r}m${-.1*r} ${.2*r} q${.1*r}${-.5*r} ${.2*r} 0`)
		path.ol.mov(d=`M0${-r}h${d}v${d}h${-d}zM${d + s} ${.9*r}q${r} 0 ${r} ${-.9*r}m${-.1*r} ${.2*r} q${.1*r}${-.5*r} ${.2*r} 0`)
		text(x=.5*r y=2.1*r) r
		text(x=w - .5*r y=2.6*r) r
		text(x=.5*w y=2.1*r) w - d
		text(x=.5*(w - r) y=3.1*r) w - r
		text(x=.5*w y=-3.9*r) w
		text.mov(x=r y =-2.9*r) d
		text.mov(x=1.5*r y=-1.9*r) r
		circle(cy=2*r r=2*s)
		circle(cy=3*r r=2*s)
		circle(cx=w cy=2.5*r r=2*s)
		circle.mov(cx=r cy=-2*r r=2*s)
		g.box__lbl.fix
			text input content-box
			text(y=.5*r) ≡
			text(y=r) track content-box
		g.box__lbl.mov
			text(x=1.05*d y=-.875*r) thumb
			text(x=1.05*d y=-.375*r) border-box
	input(type='range' value=val)
              
            
!

CSS

              
                @mixin track() { 
	width: 100%; height: 100%;
	background: none
}

@mixin thumb() {
	border: none;
	width: calc(var(--h)*1em); height: calc(var(--h)*1em);
	border-radius: 50%;
	background: 
		linear-gradient(#000 50%, transparent 0) 50% -2px/ 2px 8px no-repeat round
		#f90
}

* { margin: 0; font: inherit }

html { overflow: hidden }

.wrap {
	position: relative;
	margin: calc(var(--dh)*1em) calc(var(--dw)*1em);
	width: calc(var(--w)*1em);
	height: calc(var(--h)*1em);
	background: #ccc;
	font: calc(100vw/(var(--w) + 2*var(--dw))) ubuntu mono, consolas, monaco, monospace
}

svg {
	position: absolute;
	top: calc(var(--dh)*-1em);
	right: calc(var(--dw)*-1em);
	width: calc((var(--w) + 2*var(--dw))*1em);
	text-anchor: middle
}

marker, svg { fill: #333 }

text {
	font-size: calc(var(--h)*.1875px);
	dominant-baseline: hanging
}

:not(marker) > path { fill: none }

.gl {
	stroke-dasharray: 1%;
	stroke: #aaa
}

.ml {
	stroke: #333;
	marker-end: url(#e);
	
	&:not(.uni) { marker-start: url(#s) }
}

.ol {
	&.fix { stroke: #95a }
	
	&.mov { stroke: #b53 }
}

.box {
	&__lbl {
		text-anchor: start;
		
		&.fix {
			fill: #95a;
			transform: rotate(-90deg) translate(calc(var(--h)*.2px), calc(var(--h)*-.835px));
		}
		
		&.mov { fill: #b53 }
	}
}

.mov {
	transform: translate(calc(var(--val)*.01*(var(--w) - var(--h))*1px))
}

input {
	&::-webkit-slider-runnable-track, 
	&::-webkit-slider-thumb, & { -webkit-appearance: none }
	
	position: absolute;
	width: 100%; height: 100%;
	background: none;
	font: inherit;
	filter: grayscale(1);
	transition: filter .3s;
	cursor: pointer;
	
	&::-webkit-slider-runnable-track { @include track }
	&::-moz-range-track { @include track }
	
	&::-webkit-slider-thumb { @include thumb }
	&::-moz-range-thumb { @include thumb }
	
	&:focus {
		outline: solid 0 transparent;
		filter: grayscale(0)
	}
}
              
            
!

JS

              
                addEventListener('input', e => {
	let _t = e.target;
	_t.parentNode.style.setProperty(`--val`, +_t.value)
}, false);
              
            
!
999px

Console