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 sw = .005*h, fs = Math.round(.075*h);
- var na = Math.round(.05*fs);
- var x = -11.25*fs, y = -.5*h;
- var bbw = ~~(.95*(w + x)), bbh = h - 4*fs;
- var bby = .5*fs - .5*bbh;
- var crw = .5*bbw, crh = .5*bbh;
- var dx = .5*(bbw - crw), dy = .5*(bbh - crh);
- var crx = dx, cry = bby + dy;
- var ra = Math.round(1.25*fs);

svg(viewBox=[x, y, w, h].join(' ') 
		xmlns='http://www.w3.org/2000/svg')
	style
		| svg { color: #333; font: #{Math.round(fs)}px segoe script, comic sans ms, purisa, cursive }
		| rect { fill: #ddd }
		| [y] + rect { fill: #8ef }
		| [x], tspan { fill: currentcolor }
		| g {	color: #b53 }
		| g ~ * { font: #{Math.round(fs)}px consolas, monaco, ubuntu mono, monospace }
		| g [d], g ~ [d] {
		| 	fill: none;
		| 	stroke: currentcolor;
		| 	stroke-width: #{sw}
		| }
		| marker ~ g, tspan { color: #f90}
		| g + g, tspan:nth-child(2n) { color: #95a }
		| #e ~ [d] { marker-start: url(#s); marker-end: url(#e) }
		| [id] [d] { stroke: none }
	rect(y=bby width=bbw height=bbh)
	rect(x=crx y=cry width=crw height=crh)
	g
		path(d=`M${crx}${cry}h${crw}v${crh}h${-crw}z
						M${Math.round(1.5*crx + crw)}${cry}
						q0 ${2*fs} ${Math.round(.2*fs - .5*dx)} ${2*fs}
						m${.5*fs}${Math.round(-.25*fs)}
						q${Math.round(-1.25*fs)} ${Math.round(.25*fs)} 0 ${.5*fs}`)
		text(x=crx + 5*fs y=bby + fs) clipping
		text(x=crx + 5*fs y=bby + 2*fs) rectangle
	
	path(d=`M0${bby}h${bbw}v${bbh}h${-bbw}z
					M${Math.round(5.75*fs)}${Math.round(y + .65*fs)}
					q${2*fs} 0 ${2*fs} ${Math.round(1.65*fs)}
					m${Math.round(-.25*fs)}${-.5*fs}
					q${Math.round(.25*fs)} ${Math.round(1.25*fs)} ${.5*fs} 0
					M${.5*bbw - ra} ${bby + .5*bbh}
					a${ra} ${ra} 0 1 1 ${ra} ${ra}
					m${.5*fs}${Math.round(-.25*fs)}
					q${Math.round(-1.25*fs)} ${Math.round(.25*fs)} 0 ${.5*fs}`)
	text(y=y + fs) border-box
	text(x=Math.round(.5*fs + x) y=1.3*fs) inset(<tspan>dt</tspan> <tspan>dr</tspan> <tspan>db</tspan> <tspan>dl</tspan>)
		
	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
		path(d=`M${crx}${cry - .5*dy}
						h${Math.round(-10.5*fs)}v${.5*(crh + dy)}
						M${crx} ${Math.round(cry + crh + .5*dy)}
						h${Math.round(-7.25*fs)}v${Math.round(fs - .5*(crh + dy))}`)
		text(x=crx y=cry - .5*dy + .3*fs) dt
		text(x=crx y=cry + crh + .5*dy + .3*fs) db
	
	g
		path(d=`M${1.5*crx + crw} ${3.2*fs}
						v${dy + .5*fs}
						h${.5*dx - bbw - 5.25*fs}v${-dy - 2.2*fs}
						M${Math.round(.5*(crx - fs))} ${Math.round(-.65*fs)}
						h${Math.round(-3.25*fs)}v${Math.round(1.15*fs)}`)
		text(x=Math.round(1.5*crx + crw - .5*fs) y=3*fs) dr
		text(x=Math.round(.5*crx - .5*fs) y=-.3*fs) dl
	
	path(d=`M${crx + 1.3*fs}${bby}v${dy}`)
	path(d=`M${crx + crw} ${2*fs}h${dx}`)
	path(d=`M${crx + 1.3*fs} ${cry + crh}v${dy}`)
	path(d=`M0 0h${dx}`)

// minimal SVG
<svg viewBox='-1687 -1000 4000 2000' xmlns='http://www.w3.org/2000/svg'><style>svg{color:#333;font:150px segoe script,comic sans ms,purisa,cursive}rect{fill:#ddd}[y]+rect{fill:#8ef}[x],tspan{fill:currentcolor}g{color:#b53}g~*{font:150px consolas,monaco,ubuntu mono,monospace}g [d],g~[d]{fill:none;stroke:currentcolor;stroke-width:10}marker~g,tspan{color:#f90}g+g,tspan:nth-child(2n){color:#95a}#e~[d]{marker-start:url(#s);marker-end:url(#e)}[id] [d]{stroke:none}</style><rect y='-625' width='2196' height='1400'/><rect x='549' y='-275' width='1098' height='700'/><g><path d='M549-275h1098v700h-1098zM1922-275q0 300-244 300m75-37q-187 38 0 75'/><text x='1299' y='-475'>clipping</text><text x='1299' y='-325'>rectangle</text></g><path d='M0-625h2196v1400h-2196zM863-902q300 0 300 248m-37-75q38 188 75 0M910 75a188 188 0 1 1 188 188m75-37q-187 38 0 75'/><text y='-850'>border-box</text><text x='-1612' y='195'>inset(<tspan>dt</tspan> <tspan>dr</tspan> <tspan>db</tspan> <tspan>dl</tspan>)</text><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><path d='M549-450h-1575v525M549 600h-1087v-375'/><text x='549' y='-405'>dt</text><text x='549' y='645'>db</text></g><g><path d='M1921.5 480v425h-2709v-680M200-97h-487v173'/><text x='1847' y='450'>dr</text><text x='200' y='-45'>dl</text></g><path d='M744-625v350'/><path d='M1647 300h549'/><path d='M744 425v350'/><path d='M0 0h549'/></svg>
              
            
!

CSS

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

JS

              
                
              
            
!
999px

Console