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="ticket" role="img" aria-label="A jagged admit one pink ticket, with serial number 123456 over a white background">
<p><span>Admit One</span></p>
</div>
<!-- Rough paper filter courtesy of Sara Soueidan https://tympanus.net/codrops/2019/02/19/svg-filter-effects-creating-texture-with-feturbulence/ -->
<svg>
<defs>
<filter id='roughpaper' x='0%' y='0%' width='100%' height="100%">
<feTurbulence type="fractalNoise" baseFrequency='0.13' result='noise' numOctaves="5" />
<feDiffuseLighting in='noise' lighting-color='var(--red)' surfaceScale='1.3'>
<feDistantLight azimuth='45' elevation='70' />
</feDiffuseLighting>
</filter>
<filter class='filter' id='warp'>
<feturbulence basefrequency='0.01 0.01' id='frequency14' numoctaves='1' result='noise' seed='1' type='fractalNoise'></feturbulence>
<fedisplacementmap id='displacement14' in2='fractalNoise' in='SourceGraphic' scale='5'></fedisplacementmap>
</filter>
</defs>
</svg>
@import url("https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@62..125,100..900&display=swap");
:root {
--border-color: #d43b39;
--red: #f54949;
--text-black: #322523;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: inherit;
}
body {
height: 100vh;
display: grid;
place-items: center;
font-family: Archivo;
font-variation-settings: ;
color: var(--text-black);
background-color: #ceedf4;
}
svg {
position: fixed;
}
#roughpaper {
opacity: 0.2;
}
.ticket {
filter: drop-shadow(5px 5px 8px rgba(0, 0, 0, 0.2)) blur(0.2px);
position: relative;
}
.ticket::after {
content: "";
filter: url("#roughpaper");
clip-path: path(
"M4.3542 116.355C17.3259 117.282 20.7794 127.838 20.8847 133C91.2186 132.93 235.192 132.79 248.417 132.79C250.733 118.568 264.421 116.04 265.263 115.829C266.106 115.619 265.263 113.512 265.263 112.985C265.263 112.458 263.263 111.931 263.263 110.141C263.263 108.35 264.632 106.875 265.263 106.453C265.895 106.032 265.895 102.872 265.895 102.134C265.895 101.397 262.842 99.7112 262.842 97.7096C262.842 95.708 265.158 94.4438 265.895 91.5994C266.632 88.7551 263.263 87.8069 262.842 84.9626C262.42 82.1182 265.895 82.2235 265.895 79.0631C265.895 75.9027 262.842 76.1134 262.842 73.269C262.842 70.4247 265.369 70.3193 265.895 67.0535C266.421 63.7878 262.842 63.261 262.842 60.522C262.842 57.783 265.369 58.099 265.895 54.4119C266.421 50.7247 262.842 49.9873 262.842 47.9857C262.842 45.9841 265.79 43.2451 265.895 41.8756C265.895 39.5 263.263 38.9258 262.842 36.3975C262.42 33.8692 265.369 32.605 265.369 29.6553C265.369 26.7055 262.526 25.7574 262.526 23.9665C262.315 21.9649 267.369 19.4366 261.999 17.3296C253.66 15.6441 249.259 5.7409 248.101 1H22.6751C22.6751 1 21.7275 1.00095 21.7275 1.63208C17.9371 18.2769 6.77635 17.3286 6.03932 17.3286C5.30229 17.3286 5.51287 16.4859 3.72294 18.3821C1.93301 20.2784 4.3542 22.8067 4.3542 27.3366C4.3542 31.8665 1.61708 33.4467 2.14359 35.027C2.6701 36.6072 4.3542 37.1339 4.3542 40.821C4.3542 44.5082 1.82766 43.3494 1.09063 45.7724C0.353596 48.1954 4.3542 48.5114 4.3542 52.3039C4.3542 56.0964 1.61708 54.0948 1.61708 57.9927C1.61708 61.8905 4.3542 60.3103 4.3542 63.9975C4.3542 67.6846 1.61708 67.6846 1.61708 70.845C1.61708 74.0054 4.3542 74.1108 4.3542 77.1659C4.3542 80.2209 1.61708 79.7995 1.61708 82.3279C1.61708 84.8562 4.3542 86.9632 4.3542 89.1754C4.3542 91.3877 1.61708 92.5466 1.61708 94.8642C1.61708 97.1818 4.3542 100.132 4.3542 101.712C4.3542 103.292 2.03824 106.242 2.03824 108.033C2.03824 109.465 3.23125 111.86 3.82775 112.879C3.82775 113.511 4.35457 114.986 4.3542 116.355Z"
);
position: absolute;
inset: 0;
}
p {
z-index: 2;
padding: 0.8rem 1.2rem;
position: relative;
font-size: 3rem;
font-stretch: 85%;
font-weight: 800;
text-transform: uppercase;
text-align: center;
letter-spacing: -1px;
display: grid;
grid-template-columns: auto min-content auto;
filter: url("#warp");
mix-blend-mode: multiply;
transform: scale(0.95) translatex(-6px);
}
span {
border: 3.5px solid var(--border-color);
padding: 0 0.75rem;
}
p::after,
p::before {
content: "123456";
font-size: 1.8rem;
font-stretch: 85%;
font-weight: 400;
writing-mode: vertical-lr;
border: 3.5px solid var(--border-color);
letter-spacing: 1px;
}
p::after {
border-left: none;
border-bottom-right-radius: 0.75rem;
border-top-right-radius: 0.75rem;
}
p::before {
border-right: none;
border-bottom-left-radius: 0.75rem;
border-top-left-radius: 0.75rem;
}
Also see: Tab Triggers