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.
<body class="bg-gray-50 text-gray-600">
<div class="mx-auto container flex justify-center py-16 px-4">
<div class="flex flex-col space-y-8 w-full px-16 max-w-xl">
<!-- card -->
<div class="bg-gradient-to-tl from-gray-900 to-gray-800 text-white h-56 w-96 p-6 rounded-xl shadow-md">
<div class="h-full flex flex-col justify-between">
<div class="flex items-start justify-between space-x-4">
<div class=" text-xl font-semibold tracking-tigh">
SUPERCOMPANY
</div>
<div class="inline-flex flex-col items-center justify-center">
<svg class="h-8 w-8" width="24" height="24" stroke-width="1.5" viewBox="0 0 24 24"
fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M2 15V9C2 5.68629 4.68629 3 8 3H16C19.3137 3 22 5.68629 22 9V15C22 18.3137 19.3137 21 16 21H8C4.68629 21 2 18.3137 2 15Z"
stroke="currentColor" stroke-width="1.5"></path>
<path
d="M13 15.5V12.7M15.8571 12.7C16.5714 12.7 18 12.7 18 10.6C18 8.5 16.5714 8.5 15.8571 8.5L13 8.5V12.7M15.8571 12.7C14.7143 12.7 13.4762 12.7 13 12.7M15.8571 12.7L18 15.5"
stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M11 8.5L8 15.5L5 8.5" stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round"></path>
</svg>
<div
class="font-semibold text-white">
wallet
</div>
</div>
</div>
<div
class="inline-block w-12 h-8 bg-gradient-to-tl from-yellow-200 to-yellow-100 rounded-md shadow-inner overflow-hidden">
<div class="relative w-full h-full grid grid-cols-2 gap-1">
<div class="absolute border border-gray-900 rounded w-4 h-6 left-4 top-1"></div>
<div class="border-b border-r border-gray-900 rounded-br"></div>
<div class="border-b border-l border-gray-900 rounded-bl"></div>
<div class=""></div>
<div class=""></div>
<div class="border-t border-r border-gray-900 rounded-tr"></div>
<div class="border-t border-l border-gray-900 rounded-tl"></div>
</div>
</div>
<div class="">
<div class="text-xs font-semibold tracking-tight">
balance
</div>
<div class="text-2xl font-semibold">
$50
</div>
</div>
</div>
</div>
<!-- notification -->
<div class="relative">
<div
class="absolute right-10 flex space-x-2 items-start bg-white text-gray-900 border-gray-200 shadow-2xl -mt-16 w-72 px-2 py-3 rounded-lg">
<div class="flex-initial">
<div
class="inline-flex items-center justify-center rounded-lg bg-gradient-tl from-green-400 via-green-400 bg-green-300">
<div class="p-2">
<svg class="h-4 w-4 text-white opacity-90" width="24" height="24" stroke-width="1.5"
viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"
stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path>
<path
d="M15 8.5C14.315 7.81501 13.1087 7.33855 12 7.30872M9 15C9.64448 15.8593 10.8428 16.3494 12 16.391M12 7.30872C10.6809 7.27322 9.5 7.86998 9.5 9.50001C9.5 12.5 15 11 15 14C15 15.711 13.5362 16.4462 12 16.391M12 7.30872V5.5M12 16.391V18.5"
stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
</div>
</div>
</div>
<div class="flex-1 inline-flex items-start justify-between">
<div>
<h2 class="text-xs font-semibold tracking-tight">Loyalty program</h2>
<p class="text-xs text-gray-500 font-light">You received $5 credit</p>
</div>
<div class="text-xs text-gray-400">17:15</div>
</div>
</div>
</div>
</div>
</div>
</body>
Also see: Tab Triggers