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

              
                - var h = 2000, w = 2*h;
- var x = -.5*w, y = -.5*h;
- var d = .25*h, r = .5*d, r0 = Math.round(.03*r);
- var bw = 4*d, bh = .65*d;
- var bx = .5*(bw + r) - .5*r;
- var bf = .325;
- var by = .5*bh - bf*y;
- var sw = .004*h;
- var fs = Math.round(.075*h);
- var na = Math.round(.05*fs);

svg(viewBox=[x, 1.5*y, w, 1.3*h].join(' ') 
		xmlns='http://www.w3.org/2000/svg')
	style
		| * { font: #{fs}px segoe script, comic sans ms, cursive }
		| [x] ~ * {
		| 	stroke-width: #{sw};
		| 	font: #{fs}px consolas, monaco, monospace;
		| 	word-spacing: #{Math.round(-.375*fs)}px
		| }
		| [x] + [d] { stroke: #ccc; fill: none }
		| [d] + [d] {
		| 	stroke: #333;
		| 	marker-start: url(#s);
		| 	marker-end: url(#e)
		| }
		| rect, [r], #p *, g [x] + [d] { fill: none; stroke: #f90 }
		| [r='#{r}'] { stroke: #b5a }
		| rect ~ [r] { stroke: #b53 }
		| [r] + [y] { opacity: .3; fill: url(#p) }
		| #p * { stroke-width: #{bw}; stroke-dasharray: #{1.25*sw} }
		| g [x] { fill: #f90 }
	pattern#p(viewBox=[0, 0, bw, bh].join(' ') width='100%' height='100%')
		path(d=`M0 0l${bw} ${Math.round(2.5*bh)}`)
	marker#s(markerWidth=na markerHeight=na 
						viewBox='-8 -4 8 8' orient='auto' refX='-7')
		path(d='M-8 0 0-4V4')
	marker#e(markerWidth=na markerHeight=na 
					 viewBox='0 -4 8 8' orient='auto' refX='7')
		path(d='M8 0 0-4V4')
	g
		text(x=Math.round(.5*(bx - x) - 1.75*fs) y=Math.round(-3.25*fs)) bar gets 
			tspan(dx=Math.round(-4.25*fs) dy=Math.round(1.125*fs)) hidden
		path(d=`M${.5*(bx - x)}${Math.round(-1.75*fs)}
						Q${.5*(bx - x) - fs}${Math.round(by - bh - 1.5*fs)} ${.5*(bx - x) - fs} ${Math.round(by - bh - .5*fs)}
						m${-.5*fs}${Math.round(-.75*fs)}
						q${.5*fs} ${2*fs} ${fs} 0`)
	text(x=-(bx + r) y=Math.round(1.5*y + fs)) assembly always middle aligned
	text(x=x + .1*fs y=Math.round(bf*y - 2.375*r)) a = (w + r)/2
	text(x=bx y=Math.round(.7*fs + 1.375*r - bf*y)) x = a - r
	text(x=bx y=Math.round(1.7*fs + 1.375*r - bf*y)) x = (w - r)/2
	text(x=Math.round(x + .25*fs) y=Math.round(fs - by)) expanded
	text(x=Math.round(x + .25*fs) y=Math.round(2*fs - by)) state
	text(x=Math.round(x + .25*fs) y=Math.round(by - bh + fs)) collapsed
	text(x=Math.round(x + .25*fs) y=Math.round(by - bh + 2*fs)) state
	text(x=bx - .5*r - .3*fs y=Math.round(bf*y - 1.375*r)) d
	text(x=Math.round(-.25*(bw + r) - .3*fs) y=Math.round(bf*y - 2.375*r)) a
	text(x=Math.round(.25*(bw + r) - .3*fs) y=Math.round(bf*y - 2.375*r)) a
	text(x=-fs y=Math.round(bf*y - 3.375*r)) w + r
	text(x=bx - r - .3*fs y=Math.round(.7*fs + (bf*y + 1.375*r))) r
	text(x=bx - .3*fs y=Math.round(.7*fs + (bf*y + 1.375*r))) r
	text(x=Math.round(.25*(bw - r) - .3*fs) y=Math.round(.7*fs + 1.375*r - bf*y)) x
	text(x=Math.round(.25*(r - bw) - .3*fs) - r y=Math.round(.7*fs + 1.375*r - bf*y)) x
	text(x=-.5*r - .3*fs y=Math.round(.7*fs + 1.375*r - bf*y)) r
	text(x=-(.5*r + .3*fs) y=Math.round(.7*fs + 2.375*r - bf*y)) w
	path(d=`M0${bf*y - 3*r}V${2*r - bf*y}
					M${-(.5*r + bx)}${bf*y - 3.5*r}V${2.5*r - bf*y}
					M${bx + .5*r}${bf*y - 3.5*r}V${1.5*r + bf*y}
					M${bx - 1.5*r}${bf*y - 1.5*r}v${3*r}
					M${bx - .5*r}${bf*y}V${2.5*r - bf*y}
					M${-r} ${-bf*y}v${1.5*r}`)
	path(d=`M${bx - 1.5*r} ${Math.round(bf*y + 1.25*r)}h${r}`)
	path(d=`M${bx - .5*r} ${Math.round(bf*y + 1.25*r)}h${r}`)
	path(d=`M${bx - 1.5*r}${Math.round(bf*y - 1.25*r)}h${d}`)
	path(d=`M${-(.5*r + bx)}${Math.round(bf*y - 3.25*r)}H${.5*r + bx}`)
	path(d=`M${-(.5*r + bx)}${Math.round(bf*y - 2.25*r)}H0`)
	path(d=`M${.5*r + bx}${Math.round(bf*y - 2.25*r)}H0`)
	path(d=`M${-(.5*r + bx)} ${Math.round(1.25*r - bf*y)}H${-r}`)
	path(d=`M0 ${Math.round(1.25*r - bf*y)}h${bx - .5*r}`)
	path(d=`M${-r} ${Math.round(1.25*r - bf*y)}H0`)
	path(d=`M${-(.5*r + bx)} ${Math.round(2.25*r - bf*y)}h${bw}`)
	circle(cx=bx - .5*r cy=bf*y r=r)
	circle(cy=-bf*y r=r)
	rect(x=-r y=Math.round(by - bh) width=bw height=bh)
	rect(x=-(bx + .5*r) y=Math.round(-by) width=bw height=bh)
	circle(cx=bx - 1.5*r cy=bf*y r=r0)
	circle(cx=bx - .5*r cy=bf*y r=r0)
	circle(cx=-(.5*r + bx) cy=bf*y r=r0)
	circle(cx=bx + .5*r cy=bf*y r=r0)
	circle(cx=-r cy=-bf*y r=r0)
	circle(cy=-bf*y r=r0)
	circle(cx=r cy=-bf*y r=r0)

<svg viewBox='-2000 -1500 4000 2600' xmlns='http://www.w3.org/2000/svg'><style>*{font:150px segoe script,comic sans ms,cursive}[x]~*{stroke-width:8;font:150px consolas,monaco,monospace;word-spacing:-56px}[x]+[d]{stroke:#ccc;fill:none}[d]+[d]{stroke:#333;marker-start:url(#s);marker-end:url(#e)}rect,[r],#p *,g [x]+[d]{fill:none;stroke:#f90}[r='250']{stroke:#b5a}rect~[r]{stroke:#b53}[r]+[y]{opacity:.3;fill:url(#p)}#p *{stroke-width:2000;stroke-dasharray:10}g [x]{fill:#f90}</style><pattern id='p' viewBox='0 0 2000 325' width='100%' height='100%'><path d='M0 0l2000 813'/></pattern><marker id='s' markerWidth='8' markerHeight='8' viewBox='-8 -4 8 8' orient='auto' refX='-7'><path d='M-8 0 0-4V4'/></marker><marker id='e' markerWidth='8' markerHeight='8' viewBox='0 -4 8 8' orient='auto' refX='7'><path d='M8 0 0-4V4'/></marker><g><text x='1238' y='-487'>bar gets <tspan dx='-637' dy='169'>hidden</tspan></text><path d='M1500-262Q1350-62 1350 88m-75-112q75 300 150 0'/></g><text x='-1250' y='-1350'>assembly always middle aligned</text><text x='-1985' y='-919'>a = (w+r)/2</text><text x='1000' y='774'>x = a-r</text><text x='1000' y='924'>x = (w-r)/2</text><text x='-1962' y='-337'>expanded</text><text x='-1962' y='-187'>state</text><text x='-1962' y='313'>collapsed</text><text x='-1962' y='463'>state</text><text x='830' y='-669'>d</text><text x='-607' y='-919'>a</text><text x='518' y='-919'>a</text><text x='-150' y='-1169'>w+r</text><text x='705' y='124'>r</text><text x='955' y='124'>r</text><text x='393' y='774'>x</text><text x='-732' y='774'>x</text><text x='-170' y='774'>r</text><text x='-170' y='1024'>w</text><path d='M0-1075V825M-1125-1200V950M1125-1200V50M625-700v750M875-325V950M-250 325v375'/><path d='M625-12h250'/><path d='M875-12h250'/><path d='M625-637h500'/><path d='M-1125-1137H1125'/><path d='M-1125-887H0'/><path d='M1125-887H0'/><path d='M-1125 638H-250'/><path d='M0 638h875'/><path d='M-250 638H0'/><path d='M-1125 888h2000'/><circle cx='875' cy='-325' r='250'/><circle cy='325' r='250'/><rect x='-250' y='163' width='2000' height='325'/><rect x='-1125' y='-487' width='2000' height='325'/><circle cx='625' cy='-325' r='8'/><circle cx='875' cy='-325' r='8'/><circle cx='-1125' cy='-325' r='8'/><circle cx='1125' cy='-325' r='8'/><circle cx='-250' cy='325' r='8'/><circle cy='325' r='8'/><circle cx='250' cy='325' r='8'/></svg>
              
            
!

CSS

              
                body {
	display: flex;
	flex-direction: column;
	margin: 0;
	height: 100vh
}
              
            
!

JS

              
                
              
            
!
999px

Console