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.
<!-- include inline for Webkit < 537 and IE/Edge < 13, detected by userAgent, server side -->
<div id="social" class="btns">
<a href="https://www.facebook.com/">
<svg class="s s-face"><use xlink:href="#s-face"></use></svg>
</a>
<a href="https://www.twitter.com/">
<svg class="s s-twit"><use xlink:href="#s-twit"></use></svg>
</a>
<a href="https://plus.google.com/">
<svg class="s s-goog"><use xlink:href="#s-goog"></use></svg>
</a>
</div>
<!-- include inline at bottom of page for IE/Edge < 13 and U3/0.8+ -->
<div id="svgdefs" class="dn">
<svg style="position: absolute; width: 0; height: 0;" width="0" height="0" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="s-twit" viewBox="0 0 1024 1024">
<title>twitter</title>
<path class="path1" d="M512 0c-282.77 0-512 229.23-512 512s229.23 512 512 512 512-229.23 512-512-229.23-512-512-512zM806.242 361.088c0.292 6.508 0.442 13.056 0.442 19.638 0 200.622-152.708 431.964-431.958 431.964-85.736 0-165.536-25.136-232.726-68.214 11.876 1.408 23.962 2.126 36.216 2.126 71.13 0 136.59-24.276 188.55-64.994-66.434-1.22-122.5-45.122-141.824-105.432 9.274 1.768 18.784 2.722 28.566 2.722 13.846 0 27.258-1.856 39.998-5.324-69.452-13.952-121.786-75.312-121.786-148.868 0-0.64 0-1.278 0.016-1.91 20.47 11.37 43.878 18.2 68.764 18.988-40.74-27.222-67.54-73.692-67.54-126.368 0-27.822 7.488-53.904 20.556-76.324 74.878 91.854 186.748 152.292 312.924 158.628-2.588-11.118-3.93-22.702-3.93-34.604 0-83.84 67.98-151.812 151.818-151.812 43.666 0 83.124 18.436 110.818 47.94 34.58-6.808 67.074-19.442 96.412-36.84-11.336 35.454-35.41 65.206-66.752 83.994 30.71-3.668 59.968-11.832 87.194-23.904-20.35 30.448-46.090 57.186-75.758 78.594z"></path>
</symbol>
<symbol id="s-goog" viewBox="0 0 1024 1024">
<title>google</title>
<path class="path1" d="M437.006 818.162c0 75.068-46.39 134.392-177.758 139.176-76.984-43.786-141.49-106.952-186.908-182.866 23.69-58.496 97.692-103.046 182.316-102.114 24.022 0.252 46.41 4.114 66.744 10.7 55.908 38.866 101 63.152 112.324 107.448 2.114 8.964 3.282 18.206 3.282 27.656zM512 0c-147.94 0-281.196 62.77-374.666 163.098 36.934-20.452 80.538-32.638 126.902-32.638 67.068 0 256.438 0 256.438 0l-57.304 60.14h-67.31c47.496 27.212 72.752 83.248 72.752 145.012 0 56.692-31.416 102.38-75.78 137.058-43.28 33.802-51.492 47.966-51.492 76.734 0 24.542 51.722 61.098 75.5 78.936 82.818 62.112 99.578 101.184 99.578 178.87 0 78.726-68.936 157.104-185.866 183.742 56.348 21.338 117.426 33.048 181.248 33.048 282.77 0 512-229.23 512-512s-229.23-512-512-512zM768 384v128h-64v-128h-128v-64h128v-128h64v128h128v64h-128zM365.768 339.472c11.922 90.776-27.846 149.19-96.934 147.134-69.126-2.082-134.806-65.492-146.74-156.242-11.928-90.788 34.418-160.254 103.53-158.196 69.090 2.074 128.22 76.542 140.144 167.304zM220.886 642.068c-74.68 0-138.128 25.768-182.842 63.864-24.502-59.82-38.044-125.29-38.044-193.932 0-56.766 9.256-111.368 26.312-162.396 7.374 99.442 77.352 176.192 192.97 176.192 8.514 0 16.764-0.442 24.874-1.022-7.95 15.23-13.622 32.19-13.622 49.982 0 29.97 16.488 47.070 36.868 66.894-15.402 0-30.27 0.418-46.516 0.418z"></path>
</symbol>
<symbol id="s-face" viewBox="0 0 1024 1024">
<title>facebook</title>
<path class="path1" d="M512 0c282.77 0 512 229.23 512 512 0 261.094-195.438 476.53-448 508.026v-380.026h176l16-128h-192v-64c0-35.346 28.654-64 64-64h128v-128h-128c-106.040 0-192 85.96-192 192v64h-96v128h96v380.026c-252.562-31.496-448-246.932-448-508.026 0-282.77 229.23-512 512-512z"></path>
</symbol>
</defs>
</svg>
</div>
.dn{
display: none;
}
#social .s {
width: 10em;
height: 10em;
margin: 4px 5px;
vertical-align: middle;
fill: currentColor;
color: black;
}
/* bottom script after #svgdefs targeting IE/Edge < 13 and U3 0.8 (UCWeb 11 or more) by userAgent, server side */
(function(doc) {
if (doc.getElementById('svgdefs')){ //loop through inlined svg <defs>
Array.prototype.slice.call(doc.getElementsByTagName('use')).forEach(function(e){
var svg, symbol, viewBox, id = e.getAttribute('xlink:href').split("#")[1];
//get the viewbox from symbol node if we have a symbol id-to-fragment match
if (id && (viewBox = (symbol = doc.getElementById(id)) ? symbol.getAttribute('viewBox') : '')){
svg = e.parentNode;//svg container
svg.setAttribute('viewBox', viewBox);//inline viewBox to svg node
svg.removeChild(e);//remove <use> node, and replace with <symbol>'s svg content
Array.prototype.slice.call(symbol.childNodes).forEach(function(e){ svg.appendChild(e); });
}
});
}
})(document);
Also see: Tab Triggers