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="splash"></div>
/* colors */
$white: #FFFFFF;
$gray: #404040;
$blue1: #99C0CD;
$blue2: #5993A7;
/* Presets */
*, *:before, *:after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
position: relative;
z-index: 1;
perspective-origin: 25% 75%;
background: linear-gradient(187.47deg, $blue1 15%, $blue2 100%);
perspective-origin: 50% 50%;
}
div:before, div:after {
display: block;
content: '';
position: absolute;
}
div.splash {
width: 100vmin;
height: 100vmin;
left: -4vmin;
margin: 0 auto;
position: relative;
display: flex;
justify-content: center;
align-items: center;
background:
/* slot */
linear-gradient( darken($gray, 20%) 1.5vmin, darken($gray, 20%) 1.75vmin, transparent 10vmin) 32vmin 52vmin / 45vmin 6vmin no-repeat,
/* buttons -up-l */
linear-gradient( darken($white, 20%) .25vmin,
lighten($gray, 5%) .5vmin, lighten($gray, 5%) 4.75vmin, darken($gray, 10%) 4.75vmin, transparent 10vmin) 12.5vmin 53.5vmin / 10vmin 4vmin no-repeat,
linear-gradient( darken($gray, 20%) 1.5vmin, darken($gray, 20%) 1.75vmin, transparent 10vmin) 12vmin 53vmin / 11vmin 5vmin no-repeat,
/* top knobs */
radial-gradient(circle,
darken($gray, 0%) 0vmin,
darken($gray, 0%) 3.25vmin,transparent 3.2vmin) 83.5vmin 51.25vmin / 8vmin 8vmin no-repeat,
radial-gradient(circle,
darken($white, 10%) 0vmin,
darken($white, 10%) 3vmin,transparent 3vmin) 83.5vmin 50.5vmin / 8vmin 8vmin no-repeat,
radial-gradient(circle,
lighten($gray, 5%) 0vmin,
lighten($gray, 5%) 1.2vmin, darken($gray, 5%) 3.5vmin, darken($gray, 10%) 3.5vmin,
darken($gray, 20%) 4vmin, transparent 4vmin) 83.5vmin 51vmin / 8vmin 8vmin no-repeat,
radial-gradient(circle,
lighten($gray, 5%) 0vmin,
lighten($gray, 5%) 1vmin,transparent 1vmin) 24.25vmin 54.45vmin / 2.5vmin 2.5vmin no-repeat,
radial-gradient(circle,
darken($white, 10%) 0vmin,
darken($white, 10%) 1vmin,transparent 1vmin) 24.25vmin 54.25vmin / 2.5vmin 2.5vmin no-repeat,
radial-gradient(circle,
darken($gray, 5%) 0vmin,
darken($gray, 5%) 1.2vmin, darken($gray, 10%) 1.2vmin, darken($gray, 20%) 1.5vmin, transparent 1.5vmin) 24vmin 54vmin / 3vmin 3vmin no-repeat,
/* bottom knobs */
radial-gradient(circle,
lighten($gray, 5%) 0vmin,
lighten($gray, 5%) 1vmin,transparent 1vmin) 13.25vmin 64.5vmin / 2.5vmin 2.5vmin no-repeat,
radial-gradient(circle,
darken($white, 10%) 0vmin,
darken($white, 10%) 1vmin,transparent 1vmin) 13.25vmin 64.25vmin / 2.5vmin 2.5vmin no-repeat,
radial-gradient(circle,
lighten($gray, 5%) 0vmin,
lighten($gray, 5%) 1.2vmin, darken($gray, 10%) 1.2vmin, darken($gray, 20%) 1.5vmin, transparent 1.5vmin) 13vmin 64vmin / 3vmin 3vmin no-repeat,
radial-gradient(circle,
lighten($gray, 5%) 0vmin,
lighten($gray, 5%) 1vmin,transparent 1vmin) 18.25vmin 64.5vmin / 2.5vmin 2.5vmin no-repeat,
radial-gradient(circle,
darken($white, 10%) 0vmin,
darken($white, 10%) 1vmin,transparent 1vmin) 18.25vmin 64.25vmin / 2.5vmin 2.5vmin no-repeat,
radial-gradient(circle,
lighten($gray, 5%) 0vmin,
lighten($gray, 5%) 1.2vmin, darken($gray, 10%) 1.2vmin, darken($gray, 20%) 1.5vmin, transparent 1.5vmin) 18vmin 64vmin / 3vmin 3vmin no-repeat,
radial-gradient(circle,
lighten($gray, 5%) 0vmin,
lighten($gray, 5%) 1vmin,transparent 1vmin) 23.25vmin 64.5vmin / 2.5vmin 2.5vmin no-repeat,
radial-gradient(circle,
darken($white, 10%) 0vmin,
darken($white, 10%) 1vmin,transparent 1vmin) 23.25vmin 64.25vmin / 2.5vmin 2.5vmin no-repeat,
radial-gradient(circle,
lighten($gray, 5%) 0vmin,
lighten($gray, 5%) 1.2vmin, darken($gray, 10%) 1.2vmin, darken($gray, 20%) 1.5vmin, transparent 1.5vmin) 23vmin 64vmin / 3vmin 3vmin no-repeat,
radial-gradient(circle,
lighten($gray, 5%) 0vmin,
lighten($gray, 5%) 1vmin,transparent 1vmin) 72.25vmin 64.5vmin / 2.5vmin 2.5vmin no-repeat,
radial-gradient(circle,
darken($white, 10%) 0vmin,
darken($white, 10%) 1vmin,transparent 1vmin) 72.25vmin 64.25vmin / 2.5vmin 2.5vmin no-repeat,
radial-gradient(circle,
lighten($gray, 5%) 0vmin,
lighten($gray, 5%) 1.2vmin, darken($gray, 10%) 1.2vmin, darken($gray, 20%) 1.5vmin, transparent 1.5vmin) 72vmin 64vmin / 3vmin 3vmin no-repeat,
/* blue-bar -mid */
linear-gradient( darken($white, 20%) .25vmin,
lighten($blue2, 5%) .5vmin, lighten($blue2, 5%) 4.75vmin, darken($blue2, 10%) 4.75vmin, transparent 10vmin) 30.5vmin 63.5vmin / 25vmin 4vmin no-repeat,
linear-gradient( darken($gray, 20%) 1.5vmin, darken($gray, 20%) 1.75vmin, transparent 10vmin) 30vmin 63vmin / 26vmin 5vmin no-repeat,
/* buttons -mid */
linear-gradient( darken($white, 20%) .25vmin,
lighten($gray, 5%) .5vmin, lighten($gray, 5%) 4.75vmin, darken($gray, 10%) 4.75vmin, transparent 10vmin) 60.5vmin 63.5vmin / 10vmin 4vmin no-repeat,
linear-gradient( darken($gray, 20%) 1.5vmin, darken($gray, 20%) 1.75vmin, transparent 10vmin) 60vmin 63vmin / 11vmin 5vmin no-repeat,
/* buttons -lower-r */
linear-gradient( darken($gray, 20%) 1.5vmin, darken($gray, 20%) 1.75vmin, transparent 10vmin) 87vmin 63vmin / .5vmin 5vmin no-repeat,
linear-gradient( darken($white, 20%) .25vmin,
lighten($gray, 5%) .5vmin, lighten($gray, 5%) 4.75vmin, darken($gray, 10%) 4.75vmin, transparent 10vmin) 80.5vmin 63.5vmin / 14vmin 4vmin no-repeat,
linear-gradient( darken($gray, 20%) 1.5vmin, darken($gray, 20%) 1.75vmin, transparent 10vmin) 80vmin 63vmin / 15vmin 5vmin no-repeat,
/* line */ linear-gradient( darken($gray, 15%) 1.5vmin, darken($gray, 20%) 1.75vmin, transparent 6vmin) 10vmin 60vmin / 90vmin 2vmin no-repeat,
/* base */ linear-gradient( darken($gray, 5%) 30vmin, $gray 30vmin, transparent 3vmin) 10vmin 50vmin / 90vmin 20vmin no-repeat,
/* feet */
radial-gradient(ellipse, darken($gray, 15%) 7.5vmin, darken($gray, 30%) 8vmin, transparent 8vmin) 25vmin 69vmin / 15vmin 2vmin no-repeat,
radial-gradient(ellipse, darken($gray, 15%) 7.5vmin, darken($gray, 30%) 8vmin, transparent 8vmin) 75vmin 69vmin / 15vmin 2vmin no-repeat,
;
}
div.splash:before {
width: 100vmin;
height: 100vmin;
margin: 0 auto;
z-index: 99;
transform: perspective(1000px) rotateX(55deg);
background:
linear-gradient( lighten($gray, 40%) 0vmin, lighten($gray, 32%) 0.5vmin) 42vmin 54.5vmin / 26vmin 0.25vmin no-repeat,
linear-gradient( lighten($gray, 40%) 0vmin, lighten($gray, 32%) 0.5vmin) 42vmin 55.5vmin / 26vmin 0.25vmin no-repeat,
linear-gradient( lighten($gray, 40%) 0vmin, lighten($gray, 32%) 0.5vmin) 42vmin 56.5vmin / 26vmin 0.25vmin no-repeat,
linear-gradient( darken($white, 35%) 0vmin, darken($white, 25%) 6vmin, transparent 10vmin) 41vmin 54vmin / 28vmin 4vmin no-repeat,
/* base */ linear-gradient( darken($gray, 45%) 0vmin, darken($gray, 25%) 4vmin, transparent 6vmin) 33.5vmin 54vmin / 42.25vmin 4.75vmin no-repeat,
/* base */ linear-gradient( $gray 20vmin, darken($gray, 10%) 30vmin, transparent 3vmin) 10vmin 20vmin / 90vmin 50vmin no-repeat;
}
div.splash:after {
width: 100vmin;
height: 100vmin;
z-index: 999;
margin: 0 auto;
display: flex;
content: 'Splash';
font-family: 'Special Elite', cursive;
font-size: 3vmin;
padding-top: 19vmin;
justify-content: center;
align-items: center;
background:
/* lines and such */
linear-gradient( lighten($gray, 32%) 0vmin, lighten($gray, 32%) 0.5vmin) 69vmin 57.75vmin / 1.25vmin 2.75vmin no-repeat,
linear-gradient( lighten($gray, 40%) 0vmin, lighten($gray, 32%) 0.5vmin) 35vmin 58vmin / 33vmin 0.25vmin no-repeat,
linear-gradient( lighten($gray, 40%) 0vmin, lighten($gray, 32%) 0.5vmin) 35vmin 59vmin / 33vmin 0.25vmin no-repeat,
linear-gradient( lighten($gray, 40%) 0vmin, lighten($gray, 32%) 0.5vmin) 35vmin 60vmin / 33vmin 0.25vmin no-repeat,
linear-gradient( darken($white, 35%) 0vmin, darken($white, 25%) 6vmin, transparent 10vmin) 33.75vmin 57vmin / 38vmin 4vmin no-repeat,
/* base */ linear-gradient( darken($gray, 65%) 0vmin, darken($gray, 25%) 6vmin, transparent 14vmin) 32.25vmin 55.5vmin / 46vmin 7vmin no-repeat,
}
/* This entry skirted around the need to make water droplets that I just didn't have the energy for. So here is the #divtober 2022 entry for "splash" going with the 1984 Tom Hanks / Darryl Hannah classic rom-com instead. There is a time-lapse video of making this piece at https://youtu.be/s4rlX2cja-w */
Also see: Tab Triggers