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.
<div class="contain-demo">
<svg width="375" height="300" viewBox="0 0 375 300">
<desc>Filter to create light on tree graphic.</desc>
<filter id="demo4">
<!--Blur effect-->
<feGaussianBlur stdDeviation="3" result="blur4" />
<!--Lighting effect-->
<feSpecularLighting result="spec4" in="blur4" specularExponent="35" lighting-color="#cccccc">
<!--Light source effect-->
<fePointLight x="75" y="100" z="200">
<!--Lighting Animation-->
<animate attributeName="x" values="75;320;75" dur="10s" repeatCount="indefinite" />
</fePointLight>
</feSpecularLighting>
<!--Composition of inputs-->
<feComposite in="SourceGraphic" in2="spec4" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" />
</filter>
<desc>Filter to blur sun graphic.</desc>
<filter id="demo5">
<feGaussianBlur in="SourceGraphic" stdDeviation="2" result="blur5" />
<!--Composition of inputs-->
<feComposite in="SourceGraphic" in2="blur5" operator="arithmetic" k1="0" k2="3" k3="3" k4="0" />
</filter>
<desc>Tree with three red apples and a sun to demonstrate lighting filter animations.</desc>
<!--Apple tree graphic-->
<g class="tree" filter="url(#demo4)">
<g>
<path fill="#60432D" d="M164.946 295.159c-1.1 0-1.483-0.737-0.85-1.637 0 0 16.417-23.364 15.008-70.364 0 0 26.5 0 26.5 0 0.098 6.118 0.523 12.264 0.988 18.364 0.901 11.82 2.561 23.979 5.527 35.467 1.626 6.298 6.668 16.396 6.668 16.396 0.491 0.984-0.007 1.785-1.107 1.78 0 0-1.699-0.008-2.18-0.008 -1.677-0.003-3.354-0.001-5.03 0 -4.573 0.004-9.147 0.001-13.72 0 -9.247-0.002-18.494 0-27.74 0.001C166.989 295.159 164.946 295.159 164.946 295.159z" />
</g>
<path fill="#A6BA50" stroke="#A6BA50" stroke-linecap="round" d="M251.203 175.839c3.07 4.72 4.84 10.35 4.84 16.39 0 16.69-13.52 30.22-30.21 30.22 -4.68 0-9.11-1.06-13.06-2.96 -5.32 8.66-14.87 14.43-25.77 14.43 -12.5 0-23.22-7.59-27.82-18.41 -0.79 0.08-1.58 0.11-2.39 0.11 -16.69 0-30.21-13.53-30.21-30.22 0-4.14 0.83-8.09 2.34-11.69 -1.51-3.6-2.34-7.55-2.34-11.69 0-16.68 13.52-30.21 30.21-30.21 4.59 0 8.94 1.02 12.84 2.86 5.26-8.86 14.93-14.8 25.99-14.8 9.05 0 17.18 3.99 22.71 10.3 2.4-0.61 4.91-0.94 7.5-0.94 16.69 0 30.21 13.53 30.21 30.22C256.043 165.489 254.273 171.119 251.203 175.839z" />
<g>
<path fill="none" stroke="#59351C" stroke-width="1" stroke-linecap="round" d="M160.321 181.962c0 0-1.144-2.095 0.864-5.069"/>
<path fill="#ED6E46" stroke="#ED6E46" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" d="M170.869 192.267c-0.599 6.451-4.196 11.391-8.032 11.034 -0.803-0.075-1.553-0.376-2.229-0.863 -0.575 0.41-1.21 0.676-1.895 0.78 -3.81 0.578-7.685-4.142-8.66-10.546 -0.975-6.405 1.324-12.068 5.132-12.646 1.775-0.27 3.564 0.612 5.07 2.278 1.371-1.623 3.04-2.522 4.756-2.361C168.845 180.301 171.468 185.819 170.869 192.267z" />
</g>
<g>
<path fill="none" stroke="#59351C" stroke-width="1" stroke-linecap="round" d="M191.058 145.324c0 0-1.209-2.214 0.913-5.356"/>
<path class="apple-top" fill="#ED6E46" stroke="#ED6E46" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" d="M202.205 156.214c-0.633 6.817-4.434 12.038-8.488 11.66 -0.849-0.079-1.641-0.397-2.356-0.912 -0.608 0.433-1.279 0.715-2.002 0.824 -4.026 0.611-8.121-4.377-9.151-11.145 -1.03-6.768 1.4-12.753 5.423-13.364 1.876-0.285 3.766 0.646 5.358 2.408 1.449-1.715 3.213-2.665 5.026-2.495C200.066 143.568 202.838 149.4 202.205 156.214z" />
</g>
<g>
<path fill="none" stroke="#59351C" stroke-width="1" stroke-linecap="round" d="M226.558 180.564c0 0-1.209-2.214 0.913-5.356"/>
<path class="right-apple" fill="#ED6E46" stroke="#ED6E46" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" d="M237.705 191.454c-0.633 6.817-4.434 12.038-8.488 11.66 -0.849-0.079-1.641-0.397-2.356-0.912 -0.608 0.433-1.279 0.715-2.002 0.824 -4.026 0.611-8.121-4.377-9.151-11.145 -1.03-6.768 1.4-12.753 5.423-13.364 1.876-0.285 3.766 0.646 5.358 2.408 1.449-1.715 3.213-2.665 5.026-2.495C235.566 178.808 238.338 184.64 237.705 191.454z" />
</g>
</g>
<desc>Yellow sun moving from left to right.</desc>
<circle class="sun" fill="#F9EC48" cx="57" cy="90" r="27" filter="url(#demo5)">
<!--Sun Animation-->
<animate attributeName="cx" values="57;320;57" dur="10s" repeatCount="indefinite" />
<animate attributeName="cy" values="100;70;100;70;100" dur="10s" repeatCount="indefinite" />
</circle>
</svg>
</div>
.contain-demo {
text-align: center;
}
Also see: Tab Triggers