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="vintage"></div>
/* Presets */
$tan: #F5ECDB;
$blue: #489A95;
$brown: #5C4A4A;
$black: #303030;
$orange: #DF5B58;
$yellow: #F2AC4C;
$white: #FFFFFF;
$gray: #E5E5E5;
*, *:before, *:after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
height: 100vmin;
position: relative;
z-index: 1;
background: linear-gradient(180deg, $tan 15%, $tan 100%);
}
div:before, div:after {
display: block;
content: '';
position: absolute;
}
div.vintage {
width: 100vmin;
height: 100vmin;
margin: 0 auto;
position: relative;
display: flex;
justify-content: center;
align-items: center;
background:
/*** SURFBOARD ***/
/* rack */
linear-gradient($orange 8vmin, transparent 8vmin) 10vmin 25vmin / 80vmin 1vmin no-repeat,
linear-gradient($orange 8vmin, transparent 8vmin) 27vmin 22vmin / 1vmin 12vmin no-repeat,
linear-gradient($orange 8vmin, transparent 8vmin) 67vmin 22vmin / 1vmin 12vmin no-repeat,
/* surfboard */
linear-gradient($tan 8vmin, transparent 8vmin) 10vmin 26vmin / 80vmin 2vmin no-repeat,
radial-gradient(ellipse, $yellow 40vmin, transparent 22vmin) 10vmin 21.5vmin / 80vmin 6vmin no-repeat,
/* surfboard fin */
linear-gradient($tan 8vmin, transparent 8vmin) 8vmin 17vmin / 10vmin 20vmin no-repeat,
radial-gradient(ellipse, $yellow 5vmin, transparent 5vmin) 12vmin 17vmin / 10vmin 10vmin no-repeat,
/*** WINDOWS ***/
/* rear window 3 */
linear-gradient(-45deg, darken($gray, 10%) 6.75vmin, transparent 5vmin) 9vmin 25.75vmin / 20vmin 20vmin no-repeat,
linear-gradient(darken($white, 5%) 12.5vmin, transparent 12.5vmin) 16.75vmin 36vmin / 12.5vmin 9.75vmin no-repeat,
linear-gradient(darken($brown, 10%) 12.5vmin, transparent 12.5vmin) 16.25vmin 35.5vmin / 13.5vmin 10.5vmin no-repeat,
/* rear window 2 */
linear-gradient(-45deg, darken($gray, 10%) 6.75vmin, transparent 5vmin) 24vmin 25.75vmin / 20vmin 20vmin no-repeat,
linear-gradient(darken($white, 5%) 12.5vmin, transparent 12.5vmin) 31.75vmin 36vmin / 12.5vmin 9.75vmin no-repeat,
linear-gradient(darken($brown, 10%) 12.5vmin, transparent 12.5vmin) 31.25vmin 35.5vmin / 13.5vmin 10.5vmin no-repeat,
/* rear window 1 */
linear-gradient(-45deg, darken($gray, 10%) 6.75vmin, transparent 5vmin) 39vmin 25.75vmin / 20vmin 20vmin no-repeat,
linear-gradient(darken($white, 5%) 12.5vmin, transparent 12.5vmin) 46.75vmin 36vmin / 12.5vmin 9.75vmin no-repeat,
linear-gradient(darken($brown, 10%) 12.5vmin, transparent 12.5vmin) 46.25vmin 35.5vmin / 13.5vmin 10.5vmin no-repeat,
/* passanger window */
linear-gradient(60deg, darken($gray, 10%) 5vmin, transparent 5vmin) 79vmin 30vmin / 14vmin 15.75vmin no-repeat,
linear-gradient(-45deg, darken($gray, 10%) 6.75vmin, transparent 5vmin) 59vmin 25.75vmin / 20vmin 20vmin no-repeat,
linear-gradient(darken($white, 5%) 12.5vmin, transparent 12.5vmin) 61.75vmin 36vmin / 17.5vmin 9.75vmin no-repeat,
linear-gradient(darken($brown, 10%) 12.5vmin, transparent 12.5vmin) 61.25vmin 35.5vmin / 17.5vmin 9.75vmin no-repeat,
linear-gradient(60deg, darken($brown, 10%) 5vmin, transparent 5vmin) 79.5vmin 30vmin / 14vmin 15.75vmin no-repeat,
/* front windows */
linear-gradient(60deg, darken($white, 10%) 6vmin, transparent 6vmin) 88vmin 31vmin / 10vmin 15.75vmin no-repeat,
linear-gradient(-120deg, darken($white, 10%) 6vmin, transparent 6vmin) 78vmin 34.75vmin / 10vmin 16vmin no-repeat,
/*** TOP ***/
/* brown rail */
linear-gradient($brown 40vmin, transparent 40vmin) 3vmin 47.5vmin / 93vmin 2vmin no-repeat,
radial-gradient(circle, $brown 1vmin, transparent 1vmin) 2vmin 47.5vmin / 2vmin 2vmin no-repeat,
radial-gradient(circle, darken($brown, 10%) 1.25vmin, transparent 1vmin) 1.25vmin 46.75vmin / 3vmin 3vmin no-repeat,
linear-gradient(darken($brown, 10%) 40vmin, transparent 40vmin) 2.25vmin 47vmin / 93.5vmin 2vmin no-repeat,
/* brown window base */
linear-gradient(60deg, darken($brown, 10%) 6vmin, transparent 6vmin) 88.5vmin 29.5vmin / 14vmin 17vmin no-repeat,
linear-gradient(darken($brown, 10%) 40vmin, transparent 40vmin) 8vmin 32.25vmin / 84vmin .75vmin no-repeat,
linear-gradient($brown 40vmin, transparent 40vmin) 10vmin 33vmin / 79vmin 14vmin no-repeat,
linear-gradient(-75deg, $brown 6vmin, transparent 6vmin) -4vmin 32.5vmin / 14vmin 15vmin no-repeat,
/* brown top */
radial-gradient(ellipse, $brown 42.5vmin, transparent 42.5vmin) 7.5vmin 28vmin / 84.5vmin 10vmin no-repeat,
/*** LIGHTS ***/
/* headlights */
radial-gradient(ellipse, $white 1.75vmin, transparent 1.75vmin) 93.75vmin 58vmin / 3.5vmin 5.75vmin no-repeat,
radial-gradient(ellipse, $gray 2vmin, transparent 2vmin) 93vmin 58vmin / 4vmin 6vmin no-repeat,
/* sub lights */
radial-gradient(ellipse, $white .75vmin, transparent .75vmin) 90.5vmin 55vmin / 1.5vmin 3.75vmin no-repeat,
radial-gradient(ellipse, $gray 1vmin, transparent 1vmin) 90vmin 55vmin / 2vmin 4vmin no-repeat,
/*** BUMPERS ***/
/* front bumper */
radial-gradient(circle, darken($gray, 10%) 3vmin, transparent 3vmin) 90vmin 68vmin / 12vmin 4vmin no-repeat,
/* rear bumper */
radial-gradient(circle, darken($gray, 10%) 3vmin, transparent 3vmin) -1.5vmin 68vmin / 12vmin 4vmin no-repeat,
/*** WHEELS ***/
/* front tire */
radial-gradient(circle, $white 0vmin, $white 3.5vmin, $gray 3.5vmin, $gray 4vmin, $white 4vmin, $white 5.75vmin, $white 5.75vmin, $black 6vmin, $black 8.25vmin, transparent 8.25vmin) 70vmin 60vmin / 20vmin 20vmin no-repeat,
/* back tire */
linear-gradient($blue 30vmin, transparent 30vmin) 8vmin 60vmin / 30vmin 5vmin no-repeat,
radial-gradient(circle, $white 0vmin, $white 3.5vmin, $gray 3.5vmin, $gray 4vmin, $white 4vmin, $white 5.75vmin, $white 5.75vmin, $black 6vmin, $black 8.25vmin, transparent 8.25vmin) 12vmin 60vmin / 20vmin 20vmin no-repeat,
/* front wheelwells*/
linear-gradient($tan 30vmin, transparent 30vmin) 65vmin 70vmin / 30vmin 15vmin no-repeat,
radial-gradient(ellipse, darken($blue, 8.25%) 10vmin, transparent 8.25vmin) 61vmin 50vmin / 38vmin 40vmin no-repeat,
/* rear wheelwells*/
linear-gradient($tan 30vmin, transparent 30vmin) 0vmin 70vmin / 40vmin 35vmin no-repeat,
radial-gradient(ellipse, darken($blue, 10%) 8.5vmin, transparent 8.5vmin) 5vmin 50vmin / 38vmin 40vmin no-repeat,
radial-gradient(ellipse, darken($blue, 10%) 8.5vmin, transparent 8.5vmin) 1vmin 50vmin / 38vmin 40vmin no-repeat,
/*** BODY ***/
/* vents */
linear-gradient(darken($blue, 10%) 5vmin, transparent 5vmin) 15vmin 52vmin / 8vmin .25vmin no-repeat,
linear-gradient(darken($blue, 10%) 5vmin, transparent 5vmin) 15vmin 53vmin / 8vmin .25vmin no-repeat,
linear-gradient(darken($blue, 10%) 5vmin, transparent 5vmin) 15vmin 54vmin / 8vmin .25vmin no-repeat,
linear-gradient(darken($blue, 10%) 5vmin, transparent 5vmin) 15vmin 55vmin / 8vmin .25vmin no-repeat,
linear-gradient(darken($blue, 10%) 5vmin, transparent 5vmin) 15vmin 56vmin / 8vmin .25vmin no-repeat,
linear-gradient(darken($blue, 10%) 5vmin, transparent 5vmin) 15vmin 57vmin / 8vmin .25vmin no-repeat,
linear-gradient(darken($blue, 10%) 5vmin, transparent 5vmin) 15vmin 58vmin / 8vmin .25vmin no-repeat,
linear-gradient(darken($blue, 10%) 5vmin, transparent 5vmin) 15vmin 59vmin / 8vmin .25vmin no-repeat,
linear-gradient(darken($blue, 10%) 5vmin, transparent 5vmin) 15vmin 60vmin / 8vmin .25vmin no-repeat,
/* gastank */
radial-gradient(circle, $blue 3.25vmin, transparent 3.25vmin) 25.25vmin 52.25vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(circle, darken($blue, 10%) 3.5vmin, transparent 3.5vmin) 25vmin 52vmin / 6vmin 6vmin no-repeat,
/* doorhandle */
linear-gradient($white 5vmin, transparent 5vmin) 67vmin 54.5vmin / 4vmin 1vmin no-repeat,
radial-gradient(ellipse, darken($blue, 10%) 2.5vmin, transparent 2.5vmin) 60vmin 50vmin / 20vmin 10vmin no-repeat,
/* door */
radial-gradient(ellipse, $blue 12vmin, transparent 12vmin) 61.25vmin 44.75vmin / 20vmin 22vmin no-repeat,
radial-gradient(ellipse, darken($blue, 10%) 12vmin, transparent 12vmin) 61vmin 45vmin / 20vmin 22vmin no-repeat,
/* front */
radial-gradient(ellipse, $blue 10vmin, transparent 9vmin) 73vmin 41vmin / 30vmin 40vmin no-repeat,
radial-gradient(ellipse, $brown 7vmin, transparent 5vmin) 82vmin 38.75vmin / 20vmin 40vmin no-repeat,
/* rear */
radial-gradient(ellipse, $blue 7vmin, transparent 5vmin) 0vmin 28vmin / 20vmin 70vmin no-repeat,
linear-gradient($blue 4vmin, $blue 30vmin, transparent 30vmin) 3vmin 65vmin / 8vmin 5vmin no-repeat,
/* base */
linear-gradient($blue 4vmin, $blue 40vmin, transparent 40vmin) 8vmin 40vmin / 80vmin 30vmin no-repeat,
}
/* This entry for #divtober is for vintage. The image is inspired by a vector stock image. There is a time-lapse video of this on Youtube at https://youtu.be/yXp0_k97iqU */
Also see: Tab Triggers