HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
[[[https://codepen.io/thebabydino/pen/zEbVPO]]]
- var o = -.5*d, f = .1;
- var vb_y = -f*d, vb_x = o + vb_y;
- var ax0 = +((1 - k)*vb_y).toFixed(e);
- var ax1 = +((1 - k)*(d + vb_y)).toFixed(e);
- var r = +(.75*ax1).toFixed(e), rd = +(r/Math.sqrt(2)).toFixed(e);
- var dr = ax1 - r, c = Math.round(.551915*r);
svg(viewBox=[vb_x, vb_y, 2*d, d].join(' ')
xmlns='http://www.w3.org/2000/svg')
style
| * { fill: #{darken}; stroke-linecap: round; font: #{fs}px consolas, monaco, monospace }
| [d], [r] { fill: none; stroke: #{orange}; stroke-width: #{2*sw} }
| [x] + [d] { stroke: #{llight} }
| [d*=A], [d*=h] { stroke-width: #{4*sw} }
| [d*=A] { stroke: #{orange} }
| [d*=A] + * { stroke: #{purple}; stroke-width: #{3*sw} }
| [r] { fill: #{orange}; stroke: #{darken} }
| [r] + * { word-spacing: #{-.35*fs}px }
| [r] + [x] ~ * { font-style: italic }
//-radius text on axes
text(x=.5*(r - fs) y=-.2*fs) R
//-axes + helper lines
path(d=`M${ax0} 0H${ax1}M0${ax0}V${ax1}M${2*ram} 0V${2*ram}H0M${r - 2*ram} 0V${2*ram}H${r}M${2*ram} ${r}V${r - 2*ram}H0M${r} 0V${r}H0`)
//-radius text on axes
text(x=-.8*fs y=.5*(r + fs)) R
//-perpendic dots
path(d=`M${ram} ${ram}h1M${r - ram} ${ram}h1M${ram} ${r - ram}h1`)
//-arc
path(d=`M${r} 0A${r} ${r} 0 0 1 0 ${r}`)
//-ctrl points guides
path(d=`M${r} 0V${c}M0 ${r}H${c}`)
//-meas
text(x=(.5*c - fs) y=(r + .8*fs)) C·R
text(x=(r + .2*fs) y=(.5*c + .4*fs)) C·R
//-hl circles
circle(r=pr1)
circle(cx=r r=pr)
circle(cy=r r=pr)
circle(cx=r cy=c r=pr)
circle(cx=c cy=r r=pr)
circle(cx=r cy=r r=Math.round(.5*pr))
//-legend
text(x=ax1 y=ax1) C = .551915
//-point names
text(x=-.8*fs y=-.2*fs) O
text(x=r - .2*fs y=-.3*fs) N
text(x=r + .1*fs y=r + .6*fs) P
text(x=-.8*fs y=r + .2*fs) Q
// minimal SVG
<svg viewBox='-1500 -250 5000 2500' xmlns='http://www.w3.org/2000/svg'><style>*{fill:#333;stroke-linecap:round;font:150px consolas,monaco,monospace}[d],[r]{fill:none;stroke:#f90;stroke-width:10}[x]+[d]{stroke:#ccc}[d*=A],[d*=h]{stroke-width:20}[d*=A]{stroke:#f90}[d*=A]+*{stroke:#95a;stroke-width:15}[r]{fill:#f90;stroke:#333}[r]+*{word-spacing:-53px}[r]+[x]~*{font-style:italic}</style><text x='727' y='-30'>R</text><path d='M-238 0H2138M0-238V2138M160 0V160H0M1444 0V160H1604M160 1604V1444H0M1604 0V1604H0'/><text x='-120' y='877'>R</text><path d='M80 80h1M1524 80h1M80 1524h1'/><path d='M1604 0A1604 1604 0 0 1 0 1604'/><path d='M1604 0V885M0 1604H885'/><text x='293' y='1724'>C·R</text><text x='1634' y='503'>C·R</text><circle r='18'/><circle cx='1604' r='25'/><circle cy='1604' r='25'/><circle cx='1604' cy='885' r='25'/><circle cx='885' cy='1604' r='25'/><circle cx='1604' cy='1604' r='13'/><text x='2138' y='2138'>C = .551915</text><text x='-120' y='-30'>O</text><text x='1574' y='-45'>N</text><text x='1619' y='1694'>P</text><text x='-120' y='1634'>Q</text></svg>
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 0;
height: 100vh;
}
svg { display: block }
// minimal SVG: https://codepen.io/thebabydino/pen/pWqXLo?editors=1000
Also see: Tab Triggers