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="rise"></div>
// #divtober 09: Rise
// a.singlediv.com/divtober2022
black(alpha)
rgba(0,0,0,alpha)
white(alpha)
rgba(255,255,255,alpha)
$rise-pink = darken(pink,7)
body
min-height: 400px
height: 100vh
position: relative
background-color: white
div
position: absolute
left: 50%
top: 50%
&::before
display: block
content: ''
position: absolute
#rise
width: 200px
height: 310px
margin-left: -(@width/2)
margin-top: -(@height/2)
background: linear-gradient(black, black) 50% 6.5em / 1.6em .1em, // balloon stuff
linear-gradient( 125deg, alpha(firebrick,0) 50%, firebrick 51%) calc(50% - .4em) 6em / .8em 1em,
linear-gradient(-125deg, alpha(firebrick,0) 50%, firebrick 51%) calc(50% + .4em) 6em / .8em 1em,
linear-gradient( 125deg, alpha(maroon,0) 50%, maroon 51%) calc(50% - .7em) 5.8em / 1.5em 1.4em,
linear-gradient(-125deg, alpha(maroon,0) 50%, maroon 51%) calc(50% + .7em) 5.8em / 1.5em 1.4em,
linear-gradient(black, black) left calc(50% + .2em) bottom 5.05em / 5em .1em,
linear-gradient(173deg, black(0) 50%, black 50.5%,
black 51.5%, black(0) 52%) left calc(50% + .1em) bottom 2.6em / 5.2em 5em,
radial-gradient(circle, $rise-pink 50%, alpha(pink,0) 51%) left calc(50% - 4.7em) bottom 7.1em / 1.2em 1.2em, // nose
radial-gradient(circle, #222 50%, black(0) 51%) left calc(50% - .4em) bottom 8.4em / .4em .4em, // eyes
radial-gradient(circle, #222 50%, black(0) 51%) left calc(50% + .2em) bottom 8.2em / .4em .4em,
radial-gradient(circle at 50% 70%, #555 50%, black(0) 51%) left calc(50% + 1.2em) bottom 9.2em / 1.2em 1.2em, // ear
radial-gradient(circle at 50% 70%, #222 50%, black(0) 51%) left calc(50% + 1.2em) bottom 9em / 1.8em 1.8em,
radial-gradient(circle at 0 50%, white 55%, white(0) 55.5%) left calc(50% + .6em) bottom 7.7em / 1em 1.3em, // face
linear-gradient( 159deg, white(0) 50%, white 51%) left calc(50% - 2.3em) bottom 7.7em / 5em 1.3em,
linear-gradient( 159deg, alpha(#999,0) 50%, #999 51%) left calc(50% - 2.9em) bottom 7.5em / 6.2em 1.7em,
radial-gradient(circle at 50% 0, white 40%, #999 40.5%,
#999 70%, alpha(#999,0) 70.5%) left calc(50% - 3.1em) bottom 7.15em / .8em .4em, // teeth
radial-gradient(circle at 50% 0, white 40%, #999 40.5%,
#999 70%, alpha(#999,0) 70.5%) left calc(50% - 2.2em) bottom 7.15em / .8em .4em,
linear-gradient($rise-pink, $rise-pink) left calc(50% - 4em) bottom 6.5em / .2em .6em, // fingers
linear-gradient($rise-pink, $rise-pink) left calc(50% - 4.25em) bottom 6.4em / .7em .2em,
linear-gradient(45deg, alpha(pink,0) 35%, $rise-pink 35.5%,
$rise-pink 65%, alpha(pink,0) 65.5%) left calc(50% - 4.3em) bottom 6.5em / .5em .5em,
linear-gradient($rise-pink, $rise-pink) left calc(50% + 4.4em) bottom 6.6em / .2em .6em,
linear-gradient($rise-pink, $rise-pink) left calc(50% + 4.65em) bottom 6.4em / .7em .2em,
linear-gradient(-45deg, alpha(pink,0) 35%, $rise-pink 35.5%,
$rise-pink 65%, alpha(pink,0) 65.5%) left calc(50% + 4.7em) bottom 6.5em / .5em .5em,
linear-gradient(-160deg, #ccc 40%, alpha(#ccc,0) 40.5%) left calc(50% - 2.5em) bottom 5.1em / 2.5em 1.4em, // arms
linear-gradient(-160deg, #999 40%, alpha(#ccc,0) 40.5%) left calc(50% - 2.8em) bottom 4.6em / 2.5em 2.1em,
linear-gradient( 160deg, #ccc 40%, alpha(#ccc,0) 40.5%) left calc(50% + 2.9em) bottom 5.1em / 2.5em 1.4em,
linear-gradient( 160deg, #999 40%, alpha(#ccc,0) 40.5%) left calc(50% + 3.2em) bottom 4.6em / 2.5em 2.1em,
linear-gradient( 60deg, $rise-pink 60%, alpha(pink,0) 60.5%) left calc(50% - 4.6em) bottom 3em / .4em 2em, // toes
linear-gradient(-60deg, $rise-pink 60%, alpha(pink,0) 60.5%) left calc(50% + 5.1em) bottom 3em / .4em 2em,
linear-gradient( 160deg, alpha(#ccc,0) 60%, #ccc 60.5%) left calc(50% - 3em) bottom 3.2em / 3.3em 2em, // legs
linear-gradient( 160deg, alpha(#999,0) 60%, #999 60.5%) left calc(50% - 3.1em) bottom 3em / 3.3em 2.9em,
linear-gradient(-160deg, alpha(#ccc,0) 60%, #ccc 60.5%) left calc(50% + 3.5em) bottom 3.2em / 3.3em 2em,
linear-gradient(-160deg, alpha(#999,0) 60%, #999 60.5%) left calc(50% + 3.6em) bottom 3em / 3.3em 2.9em,
linear-gradient( 110deg, alpha(#ccc,0) 41%,
#ccc 41.5%, #ccc 56%,
#ddd 57%) left calc(50% - 1.3em) bottom 3.2em / 4em 4.5em, // body
linear-gradient(-100deg, alpha(#ccc,0) 38%,
#ccc 38.5%, #ccc 56%,
#ddd 57%) left calc(50% + 1.7em) bottom 3.2em / 3em 5.8em,
linear-gradient( 110deg, alpha(#999,0) 40%, #999 40.5%) left calc(50% - 1.45em) bottom 3em / 4.8em 4.9em,
linear-gradient(-100deg, alpha(#999,0) 38%, #999 38.5%) left calc(50% + 1.85em) bottom 3em / 3.8em 6.2em,
radial-gradient(circle, #555 50%, black(0) 51%) left calc(50% - .4em) bottom 8.9em / 1.4em 1.4em, // ear
radial-gradient(circle, #222 50%, black(0) 51%) left calc(50% - .4em) bottom 8.6em / 2em 2em,
linear-gradient( 80deg, alpha(pink,0) 45%, $rise-pink 45.5%) left calc(50% - .6em) bottom 1.1em / 1.3em 3em,// tail
linear-gradient(-80deg, alpha(pink,0) 45%, $rise-pink 45.5%) left calc(50% + .6em) bottom 1.1em / 1.3em 3em,
linear-gradient( 45deg, alpha(pink,0) 50.5%, $rise-pink 51%,
$rise-pink 80%, alpha(pink,0) 80.5%) center bottom .2em / 2em .9em,
linear-gradient( 3deg, $rise-pink 40%, alpha(pink,0) 40.5%) left calc(50% + 1.2em) bottom .2em / 1.5em 1em,
linear-gradient(-70deg, alpha(pink,0) 47.5%, $rise-pink 48%,
$rise-pink 76%, alpha(pink,0) 76.5%) left calc(50% + 2.2em) bottom .2em / 1em 1.4em,
linear-gradient( 5deg, alpha(pink,0) 55%, $rise-pink 55.5%) left calc(50% + 1.8em) bottom 1.1em / 1em .5em,
linear-gradient(110deg, $rise-pink 45%, alpha(pink,0) 45.5%) left calc(50% + 1.5em) bottom 1.1em / .5em .5em,
linear-gradient(black, black) 50% 0 / .13em 80%
background-repeat: no-repeat
animation: rise-balloon 2000ms infinite ease-in-out
&::before
width: 100px
height: @width
left: 50%
margin-left: -(@width/2)
background: radial-gradient(circle, white(.3) 50%, white(0) 50%) 80% 20% / 2em 2em
background-repeat: no-repeat
background-color: crimson
border-radius: 50%
box-shadow: 0 0 0 .2em maroon,
inset 1em -1em 0 firebrick
@keyframes rise-balloon
0, 100%
transform: translate(0,0)
50%
transform: translate(0,.5em)
// @lynnandtonic
// a.singlediv.com
Also see: Tab Triggers