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="container">
<div class="logo">
<svg class="logo-left" width="40px" height="82px" viewBox="0 0 40 82" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Switch-Logo-Red" transform="translate(-50.000000, -26.000000)" fill="#E30B20">
<g id="Logo" transform="translate(50.000000, 26.000000)">
<g id="Logo-Left">
<path d="M0.273803711,23.5623184 L0.273803711,57.6495957 C0.273803711,72.9042202 8.74123724,81.1674805 21.8617823,81.1674805 L36.1131592,81.1674805 L38.3703926,81.1674805 C38.9186824,81.1674805 39.3631592,80.7155819 39.3631592,80.1747139 L39.3631592,77.9174805 L39.3631592,3.29443359 L39.3631592,1.03720021 C39.3631592,0.488910349 38.9112606,0.0444335938 38.3703926,0.0444335938 L36.1131592,0.0444335938 L21.8617823,0.0444335938 C9.05128252,0.0444335938 0.273803711,8.89629215 0.273803711,23.5623184 Z M32.8631592,6.54443359 L32.8631592,74.6674805 L21.8617823,74.6674805 C12.2960592,74.6674805 6.77380371,69.2783818 6.77380371,57.6495957 L6.77380371,23.5623184 C6.77380371,12.4739224 12.6534686,6.54443359 21.8617823,6.54443359 L32.8631592,6.54443359 Z" id="Combined-Shape"></path>
<circle id="Oval-2" cx="20.5" cy="24.5" r="7.5"></circle>
</g>
</g>
</g>
</g>
</svg>
<svg class="logo-right" width="35px" height="81px" viewBox="0 0 35 81" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Switch-Logo-Red" transform="translate(-97.000000, -26.000000)" fill="#E30B20">
<g id="Logo" transform="translate(50.000000, 26.000000)">
<g id="Logo-Right" transform="translate(47.000000, 0.000000)">
<path d="M15.1381114,1.0658141e-14 C25.694267,1.0658141e-14 34.2482868,9.84968532 34.2482868,21.9998879 L34.2482868,59.0001121 C34.2482868,71.1487896 25.6923698,81 15.1381114,81 L1.28413033,81 C0.733221189,81 0.286621094,80.5444691 0.286621094,80.0050837 L0.286621094,0.994916299 C0.286621094,0.4454392 0.731096699,3.18976991e-16 1.28413033,7.15860419e-16 L15.1381114,1.0658141e-14 Z M16.4536133,53.0351562 C21.001333,53.0351562 24.6879883,49.348501 24.6879883,44.8007812 C24.6879883,40.2530615 21.001333,36.5664062 16.4536133,36.5664062 C11.9058935,36.5664062 8.21923828,40.2530615 8.21923828,44.8007812 C8.21923828,49.348501 11.9058935,53.0351562 16.4536133,53.0351562 Z" id="Combined-Shape"></path>
</g>
</g>
</g>
</g>
</svg>
</div>
<div class="nintendo-switch">
<svg width="127px" height="36px" viewBox="0 0 127 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Switch-Logo-Red" transform="translate(-30.000000, -119.000000)" fill="#E30B20">
<g id="NIntendo-Swtich" transform="translate(30.000000, 119.000000)">
<g id="SWITCH-TM" transform="translate(0.000000, 15.000000)">
<polygon id="M" points="124.63943 19.8397255 125.099678 19.8380639 125.651318 18.5907735 125.732239 19.8380639 126.196445 19.8397255 126.196445 17.3166504 125.447754 17.3166504 124.907743 19.1141669 124.257019 17.3166504 123.565534 17.3166504 123.565534 19.8380639 124.133929 19.8397255 124.133929 18.663208"></polygon>
<polygon id="T" points="122.533203 18 123.239502 18 123.239502 17.3167725 121.197205 17.3167725 121.197205 18 121.889709 18 121.889709 19.8763428 122.533203 19.8763428"></polygon>
<polygon id="H" points="106.740967 0.74597168 102.740967 0.74597168 102.740967 19.854126 106.740967 19.854126 106.740967 12.2470703 115.740967 12.2470703 115.740967 19.854126 119.740967 19.854126 119.740967 0.74597168 115.740967 0.74597168 115.740967 8.24707031 106.740967 8.24707031"></polygon>
<path d="M98.5358887,4.6640625 C96.7419133,1.98447366 93.5414223,0.0794677734 90.074585,0.0794677734 C84.5517375,0.0794677734 79.8419189,4.78837076 79.8419189,10.3112183 C79.8419189,15.8340658 84.5517433,20.5429688 90.074585,20.5429688 C95.0700684,20.5429688 96.559375,18.3062637 98.3901888,15.9758301 L95.3483538,13.3685429 C94.2554072,14.8455605 92.0530735,16.3088379 90.074585,16.3088379 C86.7608765,16.3088379 84.1538086,13.6225464 84.1538086,10.3088379 C84.1538086,6.99512939 86.7608765,4.41015625 90.074585,4.41015625 C92.32764,4.41015625 94.2906461,5.55068504 95.3164571,7.38723317 L98.5358887,4.6640625 Z" id="C"></path>
<polygon id="T" points="70.9171143 19.8602295 66.9171143 19.8602295 66.9171143 4.86022949 60.6860352 4.86022949 60.6860352 0.777587891 76.872567 0.777587891 76.872567 4.86022949 70.9171143 4.86022949"></polygon>
<rect id="I" x="51.8862305" y="0.755004883" width="4.22692871" height="19.1213379"></rect>
<polygon id="W" points="25.4753418 19.8670654 30.0751953 19.8670654 33.6409996 7.30556206 37.1569824 19.8670654 41.7874756 19.8670654 47.1170654 0.784423828 43.0184326 0.784423828 39.370132 14.4602751 35.3193359 0.784423828 31.9020996 0.784423828 27.9122009 14.235388 24.2581787 0.784423828 20.1101074 0.784423828"></polygon>
<path d="M13.9404297,1.13122559 C12.3590323,0.708968571 11.2706884,0.628967285 9.7214872,0.501708984 C5.06926786,0.119554925 0.502377859,2.72975069 0.502377859,5.71838379 L0.502377859,6.38256836 C0.6064428,8.64611816 1.48029431,9.48421491 3.54815423,10.5056154 C4.80348409,11.1256741 6.02141887,11.2940474 8.78497063,11.8918457 C8.84974562,11.9058568 13.3715203,12.5681527 13.6956152,13.5267944 C13.9823121,13.9893188 14.1660399,14.1034936 13.9823121,14.7343072 L13.9404297,14.878107 L13.9204319,15.0265408 C13.8422463,15.6068737 12.0654882,16.8242798 9.56036126,16.8242798 C6.80374945,16.8242798 3.88383906,16.0366644 2.10668694,15.0916748 L0.299985281,18.2983398 C6.25367868,21.4641793 17.1525399,21.2031892 17.9074682,15.5997314 L17.8227366,15.852851 C18.5575031,13.3300929 17.5755063,11.3032374 15.3840461,10.0564812 C14.0488683,9.29687762 12.7361177,8.92413929 9.7214872,8.27187668 C9.65661095,8.25784154 9.50171335,8.28119461 9.43633782,8.27187668 C5.89812981,7.76757813 4.62048089,6.8527832 4.62048089,6.19549561 C4.91173862,4.53470436 5.96081292,4.06536865 9.04986919,4.00061035 C10.2597363,3.97524696 11.3011847,4.10316242 12.6488622,4.4630127 C13.2419386,4.62137304 14.9316616,5.33621985 15.0297216,5.37430177 L16.3599218,1.97216797 C15.796273,1.75327325 15.109556,1.4434 13.9404297,1.13122559 Z" id="S"></path>
</g>
<g id="NINTENDO" transform="translate(1.000000, 0.000000)">
<path d="M119.450159,5.53466797 C119.450159,2.50359753 116.992991,0.0464294434 113.96192,0.0464294434 C110.93085,0.0464294434 108.473682,2.50359753 108.473682,5.53466797 C108.473682,8.56573841 110.93085,11.0229065 113.96192,11.0229065 C116.992991,11.0229065 119.450159,8.56573841 119.450159,5.53466797 Z M110.873682,5.53466797 C110.873682,3.82908093 112.256333,2.44642944 113.96192,2.44642944 C115.667507,2.44642944 117.050159,3.82908093 117.050159,5.53466797 C117.050159,7.24025501 115.667507,8.62290649 113.96192,8.62290649 C112.256333,8.62290649 110.873682,7.24025501 110.873682,5.53466797 Z" id="O"></path>
<path d="M96.8417358,0.423136367 L96.8417358,0.416503906 L96.646829,0.416503906 C96.5907387,0.415301329 96.5343672,0.414697266 96.4777222,0.414697266 L96.4777222,0.416503906 L92.6356812,0.416503906 L92.6356812,10.6646118 L96.8417358,10.6646118 L96.8417358,10.6550993 C99.8961625,10.4954943 102.127478,8.33109926 102.127478,5.42736816 C102.127478,2.55765709 99.9360814,0.56772137 96.8417358,0.423136367 Z M96.8028554,8.48852539 L94.7433472,8.48852539 L94.7433472,2.61755371 L96.4777222,2.61755371 L96.4777222,2.63049316 C98.5635056,2.63049316 99.827478,3.80067332 99.827478,5.42736816 C99.827478,7.05837076 98.6137147,8.35021257 96.8028554,8.48852539 Z" id="D"></path>
<polygon id="N" points="77.3265991 4.70245361 82.2143555 11.2106323 84.3222656 11.2106323 84.3222656 1 82.1370239 1 82.2143555 7.68267822 77.2611084 1 75.121521 1 75.1194458 11.2106323 77.3265991 11.2106323"></polygon>
<polygon id="T" points="48.3127441 2.67993164 51.565918 2.67993164 51.565918 0.391601562 43 0.391601562 43 2.67993164 46.1977539 2.67993164 46.1977539 10.6069336 48.3127441 10.6069336"></polygon>
<polygon id="Combined-Shape" points="61 2.46801758 66.8195801 2.46801758 66.8195801 0.468017578 59 0.468017578 59 1.73400879 59 9.28808594 59 10.5761719 66.8195801 10.5761719 66.8195801 8.57617188 61 8.57617188 61 6.32080078 66.3723145 6.32080078 66.3723145 4.49926758 61 4.49926758"></polygon>
<polygon id="N" points="2.355896 4.15063477 7.24365234 10.6588135 9.3515625 10.6588135 9.3515625 0.448181152 7.1663208 0.448181152 7.24365234 7.13085938 2.29040527 0.448181152 0.150817871 0.448181152 0.148742676 10.6588135 2.355896 10.6588135"></polygon>
<rect id="I" x="16.8916016" y="0.559082031" width="2.21386719" height="10.0170898"></rect>
<polygon id="N" points="28.8869934 4.70245361 33.7747498 11.2106323 35.8826599 11.2106323 35.8826599 1 33.6974182 1 33.7747498 7.68267822 28.8215027 1 26.6819153 1 26.6798401 11.2106323 28.8869934 11.2106323"></polygon>
</g>
</g>
</g>
</g>
</svg>
</div>
</div>
html,
body {
width: 100%;
height: 100%;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
.logo {
margin-bottom: 1em;
}
.logo-left,
.logo-right {
display: inline-block;
position: relative;
}
@keyframes logo-anim-left {
from { top: 0; }
26% { top: 0; }
29% { top: 7px; }
40% { top: 0; }
}
@keyframes logo-anim-right {
from { top: -45px; }
25% { top: -50px; }
30% { top: 7px; }
40% { top: 0px; }
}
.logo-left {
animation-duration: 2s;
animation-name: logo-anim-left;
animation-iteration-count: infinite;
}
.logo-right {
animation-duration: 2s;
animation-name: logo-anim-right;
animation-iteration-count: infinite;
}
Also see: Tab Triggers