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.
<!--
I did this burger-and-cross-spatulas illustration and thought it would be a lot of fun as an SVG animation.
-->
<svg id="burger-champ" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 500 405">
<circle class="outline" cx="250" cy="150" />
<circle class="circle" cx="250" cy="150" />
<use class="spatula right" xlink:href="#spatula" />
<use class="spatula left" xlink:href="#spatula" />
<use class="burger" xlink:href="#burger" />
<defs>
<g id="spatula">
<path fill="#FFFBF1" fill-rule="evenodd" d="M25.995 8.718A10 10 0 0135.913 0h55.175a10 10 0 019.917 8.718l10.071 77.877a16 16 0 01-6.19 14.794l-23.334 17.723A24 24 0 0172 123.481v128.938a14.42 14.42 0 016.422 11.402l4.395 103.295a34.003 34.003 0 01-.918 9.423l-4.133 17.123a14.161 14.161 0 01-27.531 0L46.1 376.539a34 34 0 01-.918-9.423l4.395-103.295A14.42 14.42 0 0156 252.419V123.67a23.993 23.993 0 01-10.551-4.558l-23.335-17.723a16.001 16.001 0 01-6.19-14.794L25.995 8.718zm17.561 13.271h-2.44l-6.072 62.857h5.475l3.037-62.857zm18.39 0l-1.214 62.857h5.536L65.053 21.99h-3.106zm21.498 0l3.037 62.857h5.476L85.883 21.99h-2.439z" clip-rule="evenodd" />
<path fill="#B2C1C9" fill-rule="evenodd" d="M35.913 4a6 6 0 00-5.95 5.23L19.89 87.109a12 12 0 004.643 11.095l23.334 17.724A20.004 20.004 0 0059.965 120H60v138h8V119.977a20.008 20.008 0 0011.132-4.05l23.334-17.724a12 12 0 004.643-11.095L97.038 9.231A6 6 0 0091.088 4H35.913zm9.742 13.989a2 2 0 011.998 2.096L44.515 85.04a4 4 0 01-3.996 3.807h-5.475a4 4 0 01-3.982-4.385l6.248-64.664a2 2 0 011.99-1.808h6.355zm14.33 0a2 2 0 00-2 1.961L56.733 84.77a4 4 0 003.999 4.077h5.536a4 4 0 004-4.077L69.014 19.95a2 2 0 00-2-1.961h-7.03zm22.5 67.05a4 4 0 003.996 3.807h5.476a4 4 0 003.98-4.385L89.69 19.797a2 2 0 00-1.99-1.808h-6.355a2 2 0 00-1.998 2.096l3.138 64.954z" clip-rule="evenodd" />
<path fill="#9AAFBA" fill-rule="evenodd" d="M60 118a2 2 0 012 2v136h4V119.977a2 2 0 011.903-1.998 17.999 17.999 0 0010.02-3.645l23.333-17.723a9.998 9.998 0 003.869-9.246L95.055 9.487A4 4 0 0091.087 6H35.913a4 4 0 00-3.966 3.487L21.875 87.365a10 10 0 003.869 9.246l23.334 17.723A18.003 18.003 0 0059.965 118H60zM45.655 15.989a4 4 0 013.995 4.193l-3.138 64.954a6 6 0 01-5.993 5.71h-5.475a6 6 0 01-5.973-6.577l6.248-64.665a4 4 0 013.982-3.615h6.354zm10.33 3.923a4 4 0 014-3.923h7.03a4 4 0 014 3.923l1.252 64.818a6 6 0 01-5.999 6.116h-5.536a6 6 0 01-5.999-6.116l1.253-64.818zm30.496 70.934a6 6 0 01-5.993-5.71L77.35 20.182a4 4 0 013.995-4.193H87.7a4 4 0 013.982 3.615l6.248 64.665a6 6 0 01-5.972 6.577H86.48zM29.962 9.231A6 6 0 0135.912 4h55.176a6 6 0 015.95 5.23l10.071 77.878a12 12 0 01-4.643 11.095l-23.334 17.724A20.008 20.008 0 0168 119.977V258h-8V120h-.035a20.004 20.004 0 01-12.097-4.073L24.534 98.203a12 12 0 01-4.643-11.095L29.962 9.231zm17.69 10.854a2 2 0 00-1.997-2.096H39.3a2 2 0 00-1.991 1.808l-6.248 64.665a4 4 0 003.982 4.384h5.475a4 4 0 003.996-3.807l3.138-64.954zm10.333-.135a2 2 0 012-1.961h7.03a2 2 0 012 1.961l1.252 64.819a4 4 0 01-3.999 4.077h-5.536a4 4 0 01-4-4.077l1.253-64.819zm28.496 68.896a4 4 0 01-3.996-3.807l-3.138-64.954a2 2 0 011.998-2.096H87.7a2 2 0 011.991 1.808l6.248 64.665a4 4 0 01-3.981 4.384H86.48z" clip-rule="evenodd" />
<path fill="#422002" d="M78.82 367.286l-4.395-103.295a10.435 10.435 0 00-20.85 0l-4.396 103.295a29.996 29.996 0 00.81 8.314l4.134 17.123a10.16 10.16 0 0019.754 0L78.01 375.6a30 30 0 00.81-8.314z" />
<path fill="#AD5A10" fill-rule="evenodd" d="M76.823 367.371l-4.396-103.295a8.434 8.434 0 00-16.854 0l-4.395 103.295a28.002 28.002 0 00.756 7.76l4.133 17.123a8.161 8.161 0 0015.866 0l4.133-17.123c.613-2.539.867-5.151.757-7.76zm-2.398-103.38l4.396 103.295a30 30 0 01-.81 8.314l-4.134 17.123a10.16 10.16 0 01-19.754 0L49.99 375.6a29.996 29.996 0 01-.81-8.314l4.395-103.295a10.435 10.435 0 0120.85 0z" clip-rule="evenodd" />
<path fill="#B2C1C9" d="M69 269a5 5 0 11-10 0 5 5 0 0110 0z" />
<path fill="#AD5A10" fill-rule="evenodd" d="M64 272a3 3 0 100-6 3 3 0 000 6zm0 2a5 5 0 100-10 5 5 0 000 10z" clip-rule="evenodd" />
<path fill="#B2C1C9" d="M69 299a5 5 0 11-10 0 5 5 0 0110 0z" />
<path fill="#AD5A10" fill-rule="evenodd" d="M64 302a3 3 0 100-6 3 3 0 000 6zm0 2a5 5 0 100-10 5 5 0 000 10z" clip-rule="evenodd" />
</g>
<g id="burger">
<path fill="#FFFBF1" fill-rule="evenodd" d="M174 69.069c1.783-1.206 2.932-2.816 3.655-4.444 1.351-3.04 1.347-6.521 1.345-8.41V56c0-18.142-23.005-49-82-49-58.995 0-82 30.858-82 49v.22c-.003 1.89-.008 5.458 1.547 8.569.871 1.741 2.234 3.374 4.275 4.533l.178.1V71c-7.18 0-13 5.82-13 13v9c0 1.515.562 2.9 1.488 3.955A12.945 12.945 0 008 103v9c0 3 2.202 5.486 5.078 5.93a6.696 6.696 0 002.004 3.846c-.06.839-.082 1.595-.082 2.224 0 4.227 1.317 7.935 4.56 10.714 3.001 2.573 7.225 3.961 12.177 4.811 9.798 1.682 25.006 1.618 46.457 1.527l.582-.003h.025C84.408 141.026 90.463 141 97 141c6.551 0 12.606.026 18.201.049h.017l.609.003c21.326.091 36.291.154 45.874-1.531 4.852-.854 8.991-2.251 11.921-4.856C176.774 131.864 178 128.163 178 124c0-.435-.01-.927-.034-1.461a6.753 6.753 0 002.716-3.577A6.002 6.002 0 00186 113v-10c0-2.712-.831-5.23-2.252-7.315A5.988 5.988 0 00186 91v-7c0-6.843-5.288-12.451-12-12.962v-1.97z" clip-rule="evenodd" />
<path fill="#FFB905" d="M97 137c57.852 0 77 2 77-13 0-4-1-14-7-14H28c-8 0-9 10-9 14 0 15 20.148 13 78 13z" />
<path fill="#ECAB05" fill-rule="evenodd" d="M115.391 134.049C109.767 134.026 103.649 134 97 134c-6.634 0-12.754.026-18.391.049-19.101.08-32.667.137-41.97-.905-6.046-.678-9.738-1.777-11.886-3.256C22.903 128.615 22 126.93 22 124c0-1.847.243-4.884 1.27-7.346.502-1.206 1.127-2.115 1.852-2.71.673-.552 1.56-.944 2.878-.944h139c.89 0 1.973.655 2.904 3.449.856 2.569 1.096 5.709 1.096 7.551 0 2.986-.882 4.667-2.636 5.916-2.044 1.455-5.593 2.551-11.511 3.228-9.099 1.042-22.457.985-41.462.905zm-.173 3C109.624 137.026 103.561 137 97 137c-6.55 0-12.615.026-18.224.049C34.846 137.235 19 137.302 19 124c0-4 1-14 9-14h139c6 0 7 10.201 7 14.201 0 13.299-15.051 13.034-58.782 12.848z" clip-rule="evenodd" />
<path fill="#703600" d="M16 104a6 6 0 016-6h150a6 6 0 016 6v3a6 6 0 01-6 6H22a6 6 0 01-6-6v-3z" />
<path fill="#693200" fill-rule="evenodd" d="M172 99H22a5 5 0 00-5 5v3a5 5 0 005 5h150a5 5 0 005-5v-3a5 5 0 00-5-5zM22 98a6 6 0 00-6 6v3a6 6 0 006 6h150a6 6 0 006-6v-3a6 6 0 00-6-6H22z" clip-rule="evenodd" />
<rect width="20" height="6" x="21" y="100" fill="#D07118" rx="3" />
<path fill="#70DF00" d="M17 116.886c0-1.139.693-2.163 1.75-2.586l10.822-4.329a20.003 20.003 0 0114.856 0L47 111a26.924 26.924 0 0020 0 26.924 26.924 0 0120 0 26.924 26.924 0 0020 0 26.924 26.924 0 0120 0 26.924 26.924 0 0020 0l2.572-1.029a20.004 20.004 0 0114.856 0l10.821 4.329a2.784 2.784 0 011.751 2.586c0 1.97-1.99 3.318-3.82 2.586l-11.918-4.767a11.47 11.47 0 00-8.524 0L147 117a26.924 26.924 0 01-20 0 26.924 26.924 0 00-20 0 26.924 26.924 0 01-20 0 26.924 26.924 0 00-20 0 26.924 26.924 0 01-20 0l-5.738-2.295a11.47 11.47 0 00-8.524 0l-11.918 4.767c-1.83.732-3.82-.616-3.82-2.586z" />
<path fill="#67CC01" fill-rule="evenodd" d="M29.944 110.9l-10.822 4.328a1.786 1.786 0 001.326 3.316l11.919-4.768a12.483 12.483 0 019.266 0l5.738 2.296a25.93 25.93 0 0019.258 0 27.917 27.917 0 0120.742 0 25.93 25.93 0 0019.258 0 27.915 27.915 0 0120.742 0 25.932 25.932 0 0019.258 0l5.738-2.296a12.481 12.481 0 019.266 0l11.918 4.768a1.786 1.786 0 001.327-3.316l-10.822-4.328a18.997 18.997 0 00-14.112 0l-2.573 1.028a27.915 27.915 0 01-20.742 0 25.932 25.932 0 00-19.258 0 27.916 27.916 0 01-20.742 0 25.93 25.93 0 00-19.258 0 27.917 27.917 0 01-20.742 0l-2.573-1.028a19 19 0 00-14.112 0zm-11.193 3.4A2.785 2.785 0 0017 116.886c0 1.97 1.99 3.318 3.82 2.586l11.918-4.767a11.47 11.47 0 018.524 0L47 117a26.924 26.924 0 0020 0 26.924 26.924 0 0120 0 26.924 26.924 0 0020 0 26.924 26.924 0 0120 0 26.924 26.924 0 0020 0l5.738-2.295a11.47 11.47 0 018.524 0l11.918 4.767c1.83.732 3.82-.616 3.82-2.586a2.784 2.784 0 00-1.751-2.586l-10.821-4.329a20.004 20.004 0 00-14.856 0L147 111a26.924 26.924 0 01-20 0 26.924 26.924 0 00-20 0 26.924 26.924 0 01-20 0 26.924 26.924 0 00-20 0 26.924 26.924 0 01-20 0l-2.572-1.029a20.003 20.003 0 00-14.856 0L18.751 114.3z" clip-rule="evenodd" />
<path fill="#FFD600" d="M178 104v9a2 2 0 104 0v-10a9 9 0 00-9-9H21a9 9 0 00-9 9v9a2 2 0 104 0v-8a6 6 0 016-6h17.965a6 6 0 013.65 1.238l24.734 18.963a6 6 0 007.302 0l24.734-18.963a5.997 5.997 0 013.65-1.238H172a6 6 0 016 6z" />
<path fill="#F0CB08" fill-rule="evenodd" d="M179 113v-9a7 7 0 00-7-7h-67.965c-1.54 0-3.037.508-4.259 1.445l-24.734 18.963a5 5 0 01-6.084 0L44.224 98.445A7 7 0 0039.964 97H22a7 7 0 00-7 7v8a1 1 0 01-2 0v-9a8 8 0 018-8h152a8 8 0 018 8v10a1 1 0 01-2 0zm-1 0v-9a6 6 0 00-6-6h-67.965c-1.32 0-2.603.435-3.65 1.238l-24.734 18.963a6 6 0 01-7.302 0L43.615 99.238A6 6 0 0039.965 98H22a6 6 0 00-6 6v8a2 2 0 11-4 0v-9a9 9 0 019-9h152a9 9 0 019 9v10a2 2 0 11-4 0z" clip-rule="evenodd" />
<path fill="#703600" d="M16 85a6 6 0 016-6h150a6 6 0 016 6v3a6 6 0 01-6 6H22a6 6 0 01-6-6v-3z" />
<path fill="#693200" fill-rule="evenodd" d="M172 80H22a5 5 0 00-5 5v3a5 5 0 005 5h150a5 5 0 005-5v-3a5 5 0 00-5-5zM22 79a6 6 0 00-6 6v3a6 6 0 006 6h150a6 6 0 006-6v-3a6 6 0 00-6-6H22z" clip-rule="evenodd" />
<rect width="50" height="6" x="21" y="81" fill="#D07118" rx="3" />
<path fill="#FFD600" d="M16 85v8a2 2 0 11-4 0v-9a9 9 0 019-9h152a9 9 0 019 9v7a2 2 0 11-4 0v-6a6 6 0 00-6-6h-23.965c-1.32 0-2.603.435-3.65 1.238l-24.734 18.963a6.002 6.002 0 01-7.302 0L87.615 80.238A6 6 0 0083.965 79H22a6 6 0 00-6 6z" />
<path fill="#F0CB08" fill-rule="evenodd" d="M15 93v-8a7 7 0 017-7h61.965a7 7 0 014.259 1.445l24.734 18.963a5 5 0 006.084 0l24.734-18.963A7 7 0 01148.035 78H172a7 7 0 017 7v6a1 1 0 002 0v-7a8 8 0 00-8-8H21a8 8 0 00-8 8v9a1 1 0 102 0zm1 0v-8a6 6 0 016-6h61.965a6 6 0 013.65 1.238l24.734 18.963a6.002 6.002 0 007.302 0l24.734-18.963a5.997 5.997 0 013.65-1.238H172a6 6 0 016 6v6a2 2 0 104 0v-7a9 9 0 00-9-9H21a9 9 0 00-9 9v9a2 2 0 104 0z" clip-rule="evenodd" />
<rect width="145" height="8" x="25" y="67" fill="#EF2424" rx="2" />
<rect width="60" height="3" x="35" y="69" fill="#F96464" rx="1.5" />
<path fill="#FFB905" d="M97 11c57.852 0 78 30 78 45 0 4 0 11-8 11H28c-9 0-9-7-9-11 0-15 20.148-45 78-45z" />
<path fill="#ECAB05" fill-rule="evenodd" d="M172 56c0-12.643-18.005-42-75-42-56.995 0-75 29.357-75 42 0 2.133.053 4.148.808 5.658.332.663.786 1.188 1.47 1.577.71.403 1.856.765 3.722.765h139c1.558 0 2.466-.337 3.01-.684.536-.343.938-.837 1.249-1.534.697-1.569.741-3.655.741-5.782zm3 0c0-15-20.148-45-78-45-57.852 0-78 30-78 45 0 4 0 11 9 11h139c8 0 8-7 8-11z" clip-rule="evenodd" />
<ellipse cx="74.769" cy="19.188" fill="#FFD464" rx="2" ry="1.5" transform="rotate(-20 74.769 19.188)" />
<ellipse cx="119.389" cy="23.545" fill="#FFD464" rx="2" ry="1.5" transform="rotate(-54 119.389 23.545)" />
<ellipse cx="105.743" cy="18.651" fill="#FFD464" rx="2" ry="1.5" transform="rotate(6 105.743 18.65)" />
<ellipse cx="76.719" cy="30.997" fill="#FFD464" rx="2" ry="1.5" transform="rotate(15 76.72 30.997)" />
<ellipse cx="127.35" cy="34.163" fill="#FFD464" rx="2" ry="1.5" transform="rotate(-13 127.35 34.163)" />
<ellipse cx="137.356" cy="26.069" fill="#FFD464" rx="2" ry="1.5" transform="rotate(19 137.356 26.07)" />
<ellipse cx="91.59" cy="24.048" fill="#FFD464" rx="2" ry="1.5" transform="rotate(-108 91.59 24.048)" />
<ellipse cx="111.425" cy="29.435" fill="#FFD464" rx="2" ry="1.5" transform="rotate(40 111.425 29.435)" />
<ellipse cx="56.578" cy="27.805" fill="#FFD464" rx="2" ry="1.5" transform="rotate(58 56.578 27.805)" />
</g>
</defs>
</svg>
body {
background-color: #110800;
}
#burger-champ {
display: block;
margin: 5rem auto 0;
max-width: 500px;
}
.outline {
fill: #fff5dc;
r: 118px;
transform-origin: 45% 40%;
animation: zoom-in 800ms cubic-bezier(0.1, 1.2, 0.8, 1);
animation-delay: 0ms;
}
.circle {
fill: #fff5dc;
stroke: #703600;
stroke-width: 14px;
r: 107px;
transform-origin: 45% 40%;
animation: zoom-in 800ms cubic-bezier(0.1, 1.2, 0.8, 1);
}
.burger {
transform-origin: 95px 75px;
transform: translate3d(153px, 60px, 0);
animation: burger-drop 1.1s cubic-bezier(0.1, 1.2, 0.8, 1);
}
.spatula {
transform-origin: 64px 230px;
}
.spatula.right {
transform: translate3d(186px, 0, 0) rotate(65deg);
animation: spin-right 1s cubic-bezier(0.1, 1.2, 1, 1);
}
.spatula.left {
transform: translate3d(186px, 0, 0) rotate(-65deg);
animation: spin-left 1s cubic-bezier(0.1, 1.2, 1, 1);
}
@keyframes zoom-in {
0% {
opacity: 0;
transform: scale(0.01);
}
75% {
transform: scale(1.1);
}
100% {
transform: scale(1);
}
}
@keyframes burger-drop {
0% {
opacity: 0;
transform: translate(120px, -300px) rotate(-0.4turn);
}
60% {
opacity: 0;
}
100% {
opacity: 1;
transform: translate(153px, 60px);
}
}
@keyframes spin-right {
0% {
opacity: 0;
transform: translate(500px) rotate(65deg);
}
30% {
opacity: 0;
}
100% {
opacity: 1;
transform: translateX(186px) rotate(-65deg);
}
}
@keyframes spin-left {
0% {
opacity: 0;
transform: translate(-200px) rotate(-65deg);
}
30% {
opacity: 0;
}
100% {
opacity: 1;
transform: translateX(186px) rotate(65deg);
}
}
var s = document.createElement("style");
s.innerHTML = "*, *:before, *:after { animation: none !important; }";
document.addEventListener("click", function () {
document.head.appendChild(s);
setTimeout(function () {
document.head.removeChild(s);
});
});
Also see: Tab Triggers