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.
<div id="nes">
<svg version="1.1" viewBox="0 0 944 658" class="line-animated">
<path
d="
M 20.25 268.402 L 665.843 420.019
M 296.094 28.75 L 909.408 154.934
M 70.137 480.665 L 637.477 622.5
M 20.25 368.176 L 665.843 524.007
M 105.351 368.176 L 476.25 453.276
M 296.094 28.75 L 20.25 268.402
M 909.408 154.934 L 665.843 420.019
M 914.299 254.707 L 665.843 524.007
M 914.299 276.228 L 665.843 551.582
M 877.128 350.568 L 637.477 622.5
M 151.325 237.101 L 101.469 287.477
M 718.496 115.654 L 473.144 374.763
M 827.295 138.039 L 584.001 401.182
M 151.325 237.101 L 521.986 323.18
M 473.144 374.763 L 483.039 583.891
M 585.633 401.182 L 585.633 609.539
M 20.25 268.402 L 20.25 368.176
M 20.25 368.176 L 70.137 480.665
M 665.843 420.019 L 665.843 524.007
M 665.843 524.007 L 665.843 551.582
M 665.843 551.582 L 637.477 622.5
M 909.408 154.934 L 914.299 254.707
M 914.299 254.707 L 914.299 276.228
M 914.299 276.228 L 877.128 350.568
M 101.469 287.477 L 105.351 368.176
M 804.743,154.934
M 700.924,134.213
M 608.62,368.752
M 504.804,348.031
M 625.807,343.9
M 521.99,323.18
M 787.625,182.461
M 683.806,161.739
M 522.219 323.566 L 631.438 348.932
M 699.293 136.707 L 805.184 161.298
M 537.452 306.697 L 647.418 332.591
M 554.081 288.423 L 664.804 313.787
M 570.388 271.817 L 679.607 297.182
M 586.657 255.31 L 695.878 280.674
M 601.923 238.764 L 710.593 264.263
M 619.108 220.614 L 726.816 245.628
M 633.906 203.66 L 743.123 229.021
M 650.176 187.151 L 759.395 212.512
M 665.843 171.26 L 773.593 196.122
M 681.667 153.174 L 790.887 178.533
M 124.589 441.542 L 174.801 453.276
M 126.609 463.772 L 176.82 475.507
M 124.589 441.542 L 127.265 463.926
M 174.896 453.879 L 176.915 476.109
M 194.68 458.366 L 244.891 470.1
M 196.699 480.597 L 246.91 492.33
M 194.875 458.365 L 196.895 480.596
M 244.461 470.78 L 246.48 493.011
M 491.484 508.543 L 492.951 542.779
M 492.951 542.779 L 500.287 551.582
M 500.287 551.582 L 519.606 556.963
M 519.606 556.963 L 525.72 551.582
M 525.72 551.582 L 525.72 525.661
M 525.72 525.661 L 507.868 505.36
M 507.868 505.36 L 495.152 503.163
M 495.152 503.163 L 491.484 508.543
M 538.437 524.193 L 539.903 558.43
M 539.903 558.43 L 547.24 567.233
M 547.24 567.233 L 566.559 572.613
M 566.559 572.613 L 572.672 567.233
M 572.672 567.233 L 572.672 541.312
M 572.672 541.312 L 554.82 521.011
M 554.82 521.011 L 542.104 518.813
M 542.104 518.813 L 538.437 524.193
"
stroke="#fff"
stroke-width="2"
fill="none"
stroke-dasharray="988.01 988.01"
stroke-dashoffset="0" /*set to 0 so that if JS is off the image will still appear (Progressive Enhancement Son!)*/
>
</path>
</svg>
</div>
body{
background: #FF0505;
height: 100%;
}
h1{
font-family: Gotham, Helvetica, san-serif;
color: #fff;
text-align: center;
letter-spacing: 2px;
text-transform: uppercase;
margin: 2em 0;
}
div{
width: 90%;
margin: 0 auto;
}
svg{
width: 100%;
height: 75%;
}
path{
-webkit-transition: stroke-dashoffset 2s ease-in-out;
transition: stroke-dashoffset 2s ease-in-out;
}
var path = document.querySelector('.line-animated path');
window.onload = function(){
path.style.strokeDashoffset = '988.01';
//Reset paths to starting position
lineDraw();
//repeat for demo purposes
setInterval(lineDraw, 5000);
};
function lineDraw(){
var length = path.getTotalLength();
// Clear any previous transition
path.style.transition = path.style.WebkitTransition =
'none';
// Set up the starting positions
path.style.strokeDasharray = length + ' ' + length;
path.style.strokeDashoffset = length;
// Trigger a layout so styles are calculated & the browser
// picks up the starting position before animating
path.getBoundingClientRect();
// Define our transition
path.style.transition = path.style.WebkitTransition =
'stroke-dashoffset 7s ease-in-out';
// Go!
path.style.strokeDashoffset = '0';
//0 is the image fully animated, 988.01 is the starting point.
};
Also see: Tab Triggers