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 id="camouflage"></div>
// #divtober 13: Camouflage
// a.singlediv.com/divtober2021
black(alpha)
rgba(0,0,0,alpha)
white(alpha)
rgba(255,255,255,alpha)
body
min-height: 250px
height: 100vh
position: relative
background-color: lightyellow
text-align: center
div
position: absolute
left: 50%
top: 50%
&:before,
&:after
display: block
content: ''
position: absolute
@media (max-width: 400px)
transform: scale(.8)
#camouflage
font-size: 10px
width: 25em
height: 15em
margin-left: -11em
margin-top: -7em
background-color: seagreen
background-repeat: no-repeat
background-image: linear-gradient(150deg, white(0) 49.5%, white(.2) 50%,
white(.2) 50.5%, white(0) 51%),
linear-gradient(105deg, alpha(yellow, 0) 47%,
alpha(yellow,.17) 49%,
alpha(yellow,.17) 52%,
alpha(yellow,.0) 53%),
linear-gradient(108deg, alpha(yellow, 0) 47%,
alpha(yellow,.14) 49%,
alpha(yellow,.14) 52%,
alpha(yellow, 0) 53%),
linear-gradient(108deg, alpha(yellow, 0) 47%,
alpha(yellow,.14) 49%,
alpha(yellow,.14) 52%,
alpha(yellow, 0) 53%),
linear-gradient(108deg, alpha(yellow, 0) 47%,
alpha(yellow,.14) 49%,
alpha(yellow,.14) 52%,
alpha(yellow, 0) 53%),
linear-gradient(108deg, alpha(yellow, 0) 47%,
alpha(yellow,.14) 49%,
alpha(yellow,.14) 52%,
alpha(yellow, 0) 53%),
linear-gradient(110deg, alpha(yellow, 0) 47%,
alpha(yellow,.16) 49%,
alpha(yellow,.16) 52%,
alpha(yellow, 0) 53%),
linear-gradient(113deg, alpha(yellow, 0) 47%,
alpha(yellow,.16) 49%,
alpha(yellow,.16) 52%,
alpha(yellow, 0) 53%),
linear-gradient(125deg, alpha(yellow, 0) 47%,
alpha(yellow,.2) 49%,
alpha(yellow,.2) 52%,
alpha(yellow, 0) 53%),
linear-gradient(to bottom, alpha(yellow, 0),
alpha(yellow, .15),
alpha(yellow, .15),
alpha(yellow, 0)),
linear-gradient(to bottom, alpha(yellow, 0),
alpha(yellow, .15),
alpha(yellow, .15),
alpha(yellow, 0)),
linear-gradient(177deg, alpha(yellow, 0) 47%,
alpha(yellow,.14) 49%,
alpha(yellow,.14) 52%,
alpha(yellow, 0) 53%),
linear-gradient(175deg, alpha(yellow, 0) 47%,
alpha(yellow,.14) 49%,
alpha(yellow,.14) 52%,
alpha(yellow, 0) 53%),
linear-gradient(175deg, alpha(yellow, 0) 47%,
alpha(yellow,.14) 49%,
alpha(yellow,.14) 52%,
alpha(yellow, 0) 53%),
linear-gradient(175deg, alpha(yellow, 0) 47%,
alpha(yellow,.14) 49%,
alpha(yellow,.14) 52%,
alpha(yellow, 0) 53%),
linear-gradient(172deg, alpha(yellow, 0) 47%,
alpha(yellow,.16) 49%,
alpha(yellow,.16) 52%,
alpha(yellow, 0) 53%),
repeating-linear-gradient(25deg, black(0),
black(0) .5em,
black(.03) .55em,
black(.03) .6em,
black(0) .65em),
repeating-linear-gradient(-45deg, black(0),
black(0) .5em,
black(.05) .55em,
black(.05) .6em,
black(0) .65em),
linear-gradient(150deg, alpha(yellow, 0) 45%,
alpha(yellow,.17) 49%,
alpha(yellow,.17) 51%,
alpha(yellow, 0) 55%),
radial-gradient(circle at 40% 50%, alpha(yellow,.4) 0,
alpha(yellow, 0) 90%),
linear-gradient(45deg, alpha(lightgreen,0) 10%,
alpha(lightgreen,1) 100%)
background-size: 90% 90%,
4em 20%, 4em 40%, 4em 55%, 4em 55%, 4em 40%, 4em 40%, 4em 30%, 4em 20%,
5em .3em, 8em .3em, 12em 5em, 12em 5em, 9em 5.2em, 7em 5.2em, 5em 5.2em,
100% 100%, 100% 100%,
100% 100%,
100% 100%,
100% 100%
background-position: 0 1.5em,
-.4em 11em, 1.5em 7.2em, 4em 3.7em, 6.6em 2.2em, 9.5em 2.5em, 12.4em 1.2em, 15em 1em, 17.5em .8em,
1em 14em, 2.7em 13.1em, 4.8em 9.2em, 7.5em 7.3em, 11em 5.4em, 14em 3.7em, 17.2em 2em,
0 0, 0 0,
0 0,
0 0,
0 0
border-radius: 15em 0
box-shadow: inset 1.2em 0 2em alpha(saddlebrown,.2),
inset 1em .5em 1.6em alpha(green,.3),
inset 0 -2em 2em alpha(saddlebrown,.3)
&:before
box-sizing: border-box
width: 3em
height: 5.5em
left: -2.8em
bottom: -2em
border-top-left-radius: 2em
border-top-right-radius: 1em
border-bottom-left-radius: 2.5em 4em
border-bottom-right-radius: 1em
border: .2em solid darkslategrey
&:after
width: 30em
height: 20em
left: -4.4em
top: -1.5em
background-repeat: no-repeat
background-image: linear-gradient(78deg, transparent 45%,
darkslategrey 46%,
darkslategrey 47%,
transparent 48%),
linear-gradient(83deg, transparent 45%,
darkslategrey 46%,
darkslategrey 47%,
transparent 48%),
radial-gradient(circle, transparent 35%,
darkslategrey 36%,
darkslategrey 50%,
transparent 51%),
linear-gradient(darkslategrey, darkslategrey),
linear-gradient(120deg, transparent 40%,
darkslategrey 41%,
darkslategrey 43.5%,
transparent 44.3%),
linear-gradient(124deg, transparent 50%,
darkslategrey 51%,
darkslategrey 52%,
transparent 52.5%),
linear-gradient(darkslategrey, darkslategrey),
linear-gradient(140deg, transparent 40%,
darkslategrey 41%,
darkslategrey 43%,
transparent 44%),
linear-gradient(135deg, transparent 40%,
darkslategrey 41%,
darkslategrey 43%,
transparent 44%),
linear-gradient(70deg, transparent 50%,
darkslategrey 51%,
darkslategrey 52%,
transparent 53%),
linear-gradient(65deg, transparent 50%,
darkslategrey 51%,
darkslategrey 52%,
transparent 53%),
linear-gradient(darkslategrey, darkslategrey),
linear-gradient(130deg, transparent 50%,
darkslategrey 51%,
darkslategrey 52%,
transparent 53%),
linear-gradient(115deg, transparent 50%,
darkslategrey 51%,
darkslategrey 52%,
transparent 53%),
linear-gradient(70deg, transparent 45%,
darkslategrey 46%,
darkslategrey 47%,
transparent 47.8%),
linear-gradient(64deg, transparent 45%,
darkslategrey 46%,
darkslategrey 47%,
transparent 47.8%),
linear-gradient(darkslategrey, darkslategrey),
linear-gradient(30deg, transparent 40%,
darkslategrey 41%,
darkslategrey 52%,
transparent 53%),
linear-gradient(30deg, transparent 40%,
darkslategrey 41%,
darkslategrey 52%,
transparent 53%),
linear-gradient(30deg, transparent 40%,
darkslategrey 41%,
darkslategrey 52%,
transparent 53%),
linear-gradient(30deg, transparent 40%,
darkslategrey 41%,
darkslategrey 52%,
transparent 53%),
linear-gradient(30deg, transparent 40%,
darkslategrey 41%,
darkslategrey 52%,
transparent 53%),
linear-gradient(30deg, transparent 40%,
darkslategrey 41%,
darkslategrey 52%,
transparent 53%),
linear-gradient(30deg, transparent 40%,
darkslategrey 41%,
darkslategrey 52%,
transparent 53%)
background-size: 7em 10em, 8em 10em,
2em 2em,
16em .2em,
4em 5em, 8.6em 7em, 1em .2em,
4.4em 5em, 4.4em 5em, 8em 6.5em, 8em 5em, 1em .2em,
6em 10em, 6em 11em, 6em 14em, 5.8em 11.5em, 2em .2em,
1em 1em, 1em 1em, 1em 1em, 1em 1em, 1em 1em, 1em 1em, 1em 1em
background-position: -1.5em 3.7em, -.8em 4em,
2em 14em,
1.2em 17em,
4em 100%, 2.3em 100%, 3em 100%,
left 7.5em bottom 1em, left 8.3em bottom 1em, 9.5em 100%, 9.2em 100%, 14.7em 100%,
left 14.2em bottom 4.5em, left 15em bottom 2em, 21em 100%, 20.5em 100%, 26em 100%,
21.8em 40%, 22.1em 45%, 22.5em 52%, 23.2em 60%, 23.7em 68%, 24.2em 75%, 24.8em 84%
// @lynnandtonic
// a.singlediv.com
Also see: Tab Triggers