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 role="img" aria-label="cartoon silhouette of a 1920s organized crime/mafia man holding a gun"></div>
html {
background-color: #d00;
/* filter: blur(1.25px) contrast(4); */
}
div {
width: 50vmin;
height: 80vmin;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-image:
/* hand + gun */
conic-gradient(at 50% 0, transparent 120deg, black 0 230deg, transparent 0),
radial-gradient(farthest-side at 50% 0%, black 99.9%, transparent 0),
linear-gradient(black, black),
radial-gradient( at 100% 50%, transparent 50%, black 0 70%, transparent 0),
conic-gradient(at 100% 70%, transparent 245deg, black 0),
linear-gradient(black, black),
linear-gradient(black, black),
radial-gradient(farthest-side at 0% 50%, black 99.9%, transparent 0),
/* neck */
conic-gradient(at 100% 50%, transparent 240deg, gray 0 250deg, transparent 0 280deg, gray 0 290deg, transparent 0),
conic-gradient(at 10% 50%, transparent 80deg, gray 0 90deg, transparent 0 110deg, gray 0 120deg, transparent 0),
linear-gradient(70deg, transparent 40%, gray 0 50%, transparent 0),
conic-gradient(at 0% 100%, transparent 15deg, gray 0 19deg, transparent 0),
/* face */
radial-gradient(farthest-side at 50% -20%, white 60%, black 0 85%, transparent 0),
radial-gradient(farthest-side at 50% 100%, white 99.99%, transparent 0),
linear-gradient(black, black),
radial-gradient(at 50% -40%, white 75%, transparent 0),
radial-gradient(ellipse 40% 100% at 50% 50%, black 99.99%, transparent 0),
/* tie and shirt */
conic-gradient(at 50% -60%, transparent 160deg, black 0 200deg, transparent 0),
conic-gradient(at 50% 290%, black 20deg, transparent 0 340deg, black 0),
conic-gradient(at 50% -40%, transparent 172deg, black 0 188deg, transparent 0),
conic-gradient(at 50% 100%, black 30deg, transparent 0 332deg, black 0),
radial-gradient(farthest-side at 50% 0%, black 99.9%, transparent 0),
conic-gradient(at 0% -900%, transparent 178deg, white 0 200deg, transparent 0),
/* arms */
linear-gradient(125deg, transparent 17%, black 0 83%, transparent 0),
radial-gradient(farthest-side at 0% 50%, black 99.9%, transparent 0),
radial-gradient(farthest-side at 90% 0%, black 60%, transparent 0),
/* hat */
radial-gradient(ellipse 40% 130% at 40% 90%, black 99.99%, transparent 0),
radial-gradient(farthest-side at 50% 0%, black 99.99%, transparent 0),
/* jacket */
radial-gradient(ellipse farthest-side at 50% 60%, black 99.99%, transparent 0),
radial-gradient(farthest-side at 50% 100%, black 99.99%, transparent 0),
linear-gradient(black, black),
linear-gradient(48deg, transparent 50%, black 0),
conic-gradient(at 100% 80%, transparent 255deg, black 0 355deg, transparent 0),
/* legs */
linear-gradient(97deg, black 70%, transparent 0),
conic-gradient(at 80% 220%, transparent 346.5deg, black 0 356deg, transparent 0),
radial-gradient(ellipse 200% 120% at 0% 0%, transparent 49%, black 0),
radial-gradient(ellipse 100% 200% at 0% 50%, black 69%, transparent 0),
linear-gradient(115deg, black 80%, transparent 0),
radial-gradient(closest-side at 50% 40%, black 99.9%, transparent),
conic-gradient(at 0% 0%, transparent 130.5deg, black 0)
;
background-size:
/* hand + gun */
5vmin 3.25vmin,
5vmin 3vmin,
1vmin 3vmin,
2.5vmin 3vmin,
2.5vmin 5.5vmin,
1.5vmin 2vmin,
1vmin 6vmin,
0.75vmin 1vmin,
/* neck */
2vmin 3vmin,
2.25vmin 3vmin,
2vmin 3vmin,
2vmin 5vmin,
/* face */
2vmin 1.5vmin,
5.25vmin 0.75vmin,
1.75vmin 0.4vmin,
5.25vmin 3.75vmin,
9.5vmin 4vmin,
/* tie and shirt */
2vmin 2vmin,
2vmin 1vmin,
3.5vmin 9vmin,
3.25vmin 3.5vmin,
6.5vmin 2vmin,
8vmin 16vmin,
/* arms */
4vmin 17vmin,
3vmin 23vmin,
8vmin 32vmin,
/* hat */
9vmin 5vmin,
14vmin 2vmin,
/* jacket */
11vmin 10vmin,
19.5vmin 1.65vmin,
19.5vmin 33vmin,
1.5vmin 5vmin,
4vmin 20vmin,
/* legs */
7.5vmin 19.5vmin,
18vmin 22vmin,
6vmin 4vmin,
4vmin 4vmin,
1vmin 4vmin,
6vmin 4vmin,
6vmin 6vmin
;
background-position:
/* hand + gun */
11vmin 13vmin,
11vmin 16vmin,
14vmin 12vmin,
13vmin 11vmin,
15vmin 10vmin,
15.75vmin 8.5vmin,
16.5vmin 5vmin,
17.25vmin 5.5vmin,
/* neck */
20vmin 20vmin,
30vmin 20vmin,
19.75vmin 22.25vmin,
30.6vmin 22.4vmin,
/* face */
24.75vmin 15.5vmin,
23.5vmin 15.5vmin,
25vmin 17.5vmin,
23.5vmin 16vmin,
21.75vmin 12vmin,
/* tie and shirt */
25vmin 20vmin,
25vmin 21.8vmin,
24.3vmin 22.5vmin,
24.45vmin 31vmin,
23vmin 19vmin,
24vmin 20vmin,
/* arms */
15vmin 19.75vmin,
36.5vmin 19.75vmin,
8vmin 18vmin,
/* hat */
22.75vmin 7.5vmin,
19vmin 11.5vmin,
/* jacket */
21vmin 15vmin,
17.5vmin 18.5vmin,
17.5vmin 20vmin,
17.5vmin 52.5vmin,
33.5vmin 39vmin,
/* legs */
19.5vmin 52.5vmin,
23vmin 52.5vmin,
14.5vmin 71vmin,
21vmin 71vmin,
20.25vmin 71vmin,
32vmin 100%,
32vmin 72vmin
;
background-repeat: no-repeat;
}
Also see: Tab Triggers