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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<ol>
<li>just a box</li>
<li>svg (complex pattern) in a box</li>
<li>svg (complex pattern) in an img box</li>
<li>svg (simple) in a box</li>
<li>png in an img box</li>
</ol>
<div id="purple-box" class="box" style="background-color:#db00db; margin-right: 2em;"></div>
<div id="svg-box" class="box">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 240 240" enable-background="new 0 0 240 240" xml:space="preserve">
<symbol id="leaf" viewBox="-117.5 -77.262 235 154.524">
<radialGradient id="SVGID_1_" cx="-43.2896" cy="-106.1586" r="151.8733" gradientTransform="matrix(1 -0.0042 0.0042 1 42.2662 43.0452)" gradientUnits="userSpaceOnUse">
<stop offset="0" style="stop-color:#1B1464"/>
<stop offset="0.3465" style="stop-color:#0071BC"/>
<stop offset="1" style="stop-color:#FFFFFF"/>
</radialGradient>
<path fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_1_)" d="M116.145-60.709
c-19.773-19.613-216.602-23.947-231.989-1.203C-126.641-40.162-83.69,48.077-15.033,53.996
c4.724,10.612,11.045,23.266,11.045,23.266s3.809-9.856,10.174-22.29C114.204,22.353,121.789-47.427,116.145-60.709z"/>
</symbol>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.2105 0 0 -0.2105 120 23.5)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.2059 -0.0438 -0.0438 -0.2059 99.0939 25.5922)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.1923 -0.0856 -0.0856 -0.1923 79.0797 31.9853)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.1703 -0.1237 -0.1237 -0.1703 60.8321 42.3999)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.1408 -0.1564 -0.1564 -0.1408 45.1485 56.3808)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.1052 -0.1823 -0.1823 -0.1052 32.7144 73.317)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.065 -0.2002 -0.2002 -0.065 24.0733 92.4683)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.022 -0.2093 -0.2093 -0.022 19.6028 112.9976)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.022 -0.2093 -0.2093 0.022 19.4983 134.0078)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.065 -0.2002 -0.2002 0.065 23.7643 154.5807)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.1052 -0.1823 -0.1823 0.1052 32.2144 173.817)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.1408 -0.1564 -0.1564 0.1408 44.4794 190.8761)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.1703 -0.1237 -0.1237 0.1703 60.0231 205.0123)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.1923 -0.0856 -0.0856 0.1923 78.1662 215.608)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.2059 -0.0438 -0.0438 0.2059 98.1158 222.1999)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.2105 0 0 0.2105 119 224.5)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.2059 0.0438 0.0438 0.2059 139.9061 222.4078)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.1923 0.0856 0.0856 0.1923 159.9203 216.0147)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.1703 0.1237 0.1237 0.1703 178.1679 205.6001)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.1408 0.1564 0.1564 0.1408 193.8515 191.6192)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.1052 0.1823 0.1823 0.1052 206.2856 174.683)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.065 0.2002 0.2002 0.065 214.9267 155.5317)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.022 0.2093 0.2093 0.022 219.3972 135.0024)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.022 0.2093 0.2093 -0.022 219.5017 113.9921)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.065 0.2002 0.2002 -0.065 215.2357 93.4193)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.1052 0.1823 0.1823 -0.1052 206.7856 74.183)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.1408 0.1564 0.1564 -0.1408 194.5206 57.1239)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.1703 0.1237 0.1237 -0.1703 178.9769 42.9877)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.1923 0.0856 0.0856 -0.1923 160.8338 32.3921)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.2059 0.0438 0.0438 -0.2059 140.8842 25.8001)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.2105 0 0 -0.2105 120 33.5)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.1923 -0.0856 -0.0856 -0.1923 82.5242 40.1904)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.1408 -0.1564 -0.1564 -0.1408 51.0096 61.5451)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.065 -0.2002 -0.2002 -0.065 30.9054 93.8718)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.022 -0.2093 -0.2093 0.022 25.6877 131.5808)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.1052 -0.1823 -0.1823 0.1052 36.2587 168.1519)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.1703 -0.1237 -0.1237 0.1703 60.7906 197.2617)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.2059 -0.0438 -0.0438 0.2059 95.0416 213.8768)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.2059 0.0438 0.0438 0.2059 133.0895 215.1242)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.1703 0.1237 0.1237 0.1703 168.3553 200.7884)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.1052 0.1823 0.1823 0.1052 194.7413 173.3481)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(-0.022 0.2093 0.2093 0.022 207.6852 137.5479)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.065 0.2002 0.2002 -0.065 204.9487 99.5781)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.1408 0.1564 0.1564 -0.1408 187.0051 66.004)" overflow="visible"/>
<use xlink:href="#leaf" width="235" height="154.524" x="-117.5" y="-77.262" transform="matrix(0.1923 0.0856 0.0856 -0.1923 156.957 42.6308)" overflow="visible"/>
</svg>
</div>
<div id="svg-img-box" class="box"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/59506/flower-test.svg" width="100%" height="auto"/></div>
<div id="simple-svg-box" class="box"><svg version="1.1" id="em" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
<path fill="#CCEEEB" stroke="#00A99D" stroke-width="16" stroke-miterlimit="10" d="M44.898,172.447
C34.322,142.552-12.034,31.149,45.193,45.604s63.977-0.426,79.351-15.044c17.994-17.109,66.077-31.268,57.227,22.714
c-8.85,53.982,10.991,99.613-8.555,115.929c-11.385,9.504-62.171-16.735-47.422-55.673s-56.932-30.678-46.608-1.18
s33.809,68.184-3.316,71.897C49.323,186.902,47.662,180.259,44.898,172.447z"/>
</svg>
</div>
<div id="img-box" class="box"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/59506/profile.png" width="100%" height="auto"/></div>
.box{
width:200px;
height: 200px;
float:left;
-webkit-filter: blur(0px);
filter: blur(0px);
}
ol {padding:0;}
li {
width: 200px;
display:inline-block;
text-align:center;
font-family: sans-serif;
vertical-align: top;
}
var blurElement = {a:0};//start the blur at 0 pixels
TweenMax.to(blurElement, 10, {a:20, onUpdate:applyBlur});
//here you pass the filter to the DOM element
function applyBlur()
{
TweenMax.set(['.box'], {webkitFilter:"blur(" + blurElement.a + "px)",filter:"blur(" + blurElement.a + "px)"});
};
Also see: Tab Triggers