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="component"></div>
$test: #bada55;
$black: #190c05;
$light-gray: #969597;
$gray: #2d2b2c;
$blue: #3d4982;
$green: #469156;
$red: #ce4145;
$light-gold: #fde9b2;
$dark-gold: #d3a344;
$white: #ffffff;
div, div:before, div:after {
display: block;
content: '';
position: absolute;
box-sizing:border-box;
}
body {
height: 100vh;
width: 100vw;
display: flex;
transform: scale(1.2);
justify-content: center;
align-items: center;
background:
radial-gradient($white, darken($white, 30%));
}
$blue-w: 20vmin;
$blue-h: 35vmin;
/*** BLUE AND CABLES ***/
div.component {
width: 100vmin;
height: 100vmin;
left: 8vmin;
transform: scale(1.5);
display: flex;
margin: 0 auto;
position: relative;
background:
/* gold */
radial-gradient(ellipse at 50% 50%, $dark-gold 1vmin, transparent 1vmin) calc(#{$blue-w} - 3.75vmin) calc(#{$blue-h} + 16.65vmin) / 2vmin 2vmin no-repeat,
linear-gradient(-28deg, transparent 2vmin, $dark-gold 2vmin, $dark-gold 4vmin, transparent 4vmin) calc(#{$blue-w} - 3vmin) calc(#{$blue-h} + 14.5vmin) / 5vmin 4vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $dark-gold 1vmin, transparent 1vmin) calc(#{$blue-w} + .75vmin) calc(#{$blue-h} + 14.25vmin) / 2vmin 2vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $black 2.75vmin, transparent 1vmin) calc(#{$blue-w} - .5vmin) calc(#{$blue-h} + 12vmin) / 5.5vmin 6vmin no-repeat,
radial-gradient(ellipse at 50% 50%, darken($light-gold, 45%) 3vmin, transparent 1vmin) calc(#{$blue-w} - .5vmin) calc(#{$blue-h} + 11.5vmin) / 6vmin 6.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $light-gold .5vmin, darken($light-gold, 50%) 3.25vmin, transparent 1vmin) calc(#{$blue-w}) calc(#{$blue-h} + 11vmin) / 6.5vmin 7vmin no-repeat,
/* blue highlights */
linear-gradient(-28deg, darken($blue,5%) 1vmin, transparent 1vmin) calc(#{$blue-w} + 2vmin) calc(#{$blue-h} + 8vmin) / 3vmin 2vmin no-repeat,
linear-gradient(-27deg, transparent 4.5vmin, darken($blue, 10%) 4.5vmin, $blue 5.5vmin, transparent 5vmin)
calc(#{$blue-w} + 4.75vmin) calc(#{$blue-h} + 6.5vmin) / 7vmin 5vmin no-repeat,
linear-gradient(153deg, transparent 4.5vmin, darken($blue, 10%) 4.5vmin, $blue 8vmin, transparent 5vmin)
calc(#{$blue-w} + 6.5vmin) calc(#{$blue-h} + 7.5vmin) / 7vmin 12vmin no-repeat,
/* blue base */
radial-gradient(ellipse at 50% 50%, $blue 3.5vmin, transparent 1vmin) calc(#{$blue-w} - .25vmin) calc(#{$blue-h} + 10vmin) / 7vmin 8.75vmin no-repeat,
linear-gradient(140deg, $blue 4.5vmin, transparent 1vmin) calc(#{$blue-w} + 11vmin) calc(#{$blue-h} + 6.5vmin) / 4vmin 6vmin no-repeat,
linear-gradient(-28deg, transparent 5vmin, $blue 4vmin, $blue 11vmin, transparent 5vmin) calc(#{$blue-w} + 5vmin) calc(#{$blue-h}) / 11vmin 18vmin no-repeat,
linear-gradient(-28deg, transparent 5vmin, $blue 5vmin, $blue 10.5vmin, transparent 5vmin) calc(#{$blue-w} + 1.25vmin) calc(#{$blue-h} - .75vmin) / 10vmin 18vmin no-repeat,
linear-gradient(-10deg, $blue 4.5vmin, transparent 1vmin) calc(#{$blue-w} + 11vmin) calc(#{$blue-h} + 1vmin) / 6vmin 8vmin no-repeat,
linear-gradient(140deg, $blue 4.5vmin, transparent 1vmin) calc(#{$blue-w} + 16vmin) calc(#{$blue-h} + 6.5vmin) / 4vmin 6vmin no-repeat,
/* blue cord ends */
radial-gradient(ellipse at 50% 50%, $blue 2.75vmin, transparent 1vmin) 35.5vmin 39vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $black 2.75vmin, transparent 1vmin) 36.25vmin 38.7vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $blue 2.75vmin, transparent 1vmin) 37vmin 38.35vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $black 2.75vmin, transparent 1vmin) 37.75vmin 38vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $blue 2.75vmin, transparent 1vmin) 38.5vmin 37.75vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $black 2.75vmin, transparent 1vmin) 39.25vmin 37.5vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $blue 2.75vmin, transparent 1vmin) 40vmin 37.15vmin / 5.5vmin 5.5vmin no-repeat,
/* green cord ends */
radial-gradient(ellipse at 50% 50%, $green 2.75vmin, transparent 1vmin) 46vmin 41.5vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $black 2.75vmin, transparent 1vmin) 46.75vmin 41vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $green 2.75vmin, transparent 1vmin) 47.5vmin 40.5vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $black 2.75vmin, transparent 1vmin) 48.25vmin 40vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $green 2.75vmin, transparent 1vmin) 49vmin 39.5vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $black 2.75vmin, transparent 1vmin) 49.75vmin 39vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $green 2.75vmin, transparent 1vmin) 50.5vmin 38.5vmin / 5.5vmin 5.5vmin no-repeat,
/* red cord ends */
linear-gradient(135deg, transparent 3vmin, $red 3vmin, $red 4.5vmin, transparent 1vmin) 60.5vmin 42vmin / 5vmin 5vmin no-repeat,
radial-gradient(ellipse at 50% 50%,$red 2.75vmin, transparent 1vmin) 56vmin 45vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $black 2.75vmin, transparent 1vmin) 56.75vmin 44.25vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $red 2.75vmin, transparent 1vmin) 57.5vmin 43.5vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $black 2.75vmin, transparent 1vmin) 58.25vmin 42.75vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $red 2.75vmin, transparent 1vmin) 59vmin 42vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $black 2.75vmin, transparent 1vmin) 59.75vmin 41.25vmin / 5.5vmin 5.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $red 2.75vmin, transparent 1vmin) 60.5vmin 40.5vmin / 5.5vmin 5.5vmin no-repeat,
/* red cable */
radial-gradient(ellipse at -60vmin 1vmin, transparent 79.5vmin, $black 79.5vmin, $light-gray 80vmin, $gray 81.5vmin, $black 82.5vmin, transparent 77vmin) 62vmin -14vmin / 100vmin 170vmin no-repeat,
/* green cable */
radial-gradient(ellipse at -35vmin 1vmin, transparent 79.5vmin, $black 79.5vmin, $light-gray 80vmin, $gray 81.5vmin, $black 82.5vmin, transparent 77vmin) 48vmin -50vmin / 90vmin 160vmin no-repeat,
/* blue cable */
radial-gradient(ellipse at -25vmin 1vmin,transparent 74vmin, $black 74vmin, $light-gray 74.5vmin, $gray 76vmin, $black 77vmin, transparent 1vmin,
) 43vmin -54vmin / 90vmin 150vmin no-repeat,
}
$green-w: 29vmin;
$green-h: 38.5vmin;
/*** GREEN ***/
div.component:after {
width: 80vmin;
height: 64vmin;
transform: rotate(-10deg);
background:
/*** GREEN ***/
/* gold */
radial-gradient(ellipse at 50% 50%, $dark-gold 1vmin, transparent 1vmin) calc(#{$green-w} - 3.75vmin) calc(#{$green-h} + 16.65vmin) / 2vmin 2vmin no-repeat,
linear-gradient(-28deg, transparent 2vmin, $dark-gold 2vmin, $dark-gold 4vmin, transparent 4vmin) calc(#{$green-w} - 3vmin) calc(#{$green-h} + 14.5vmin) / 5vmin 4vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $dark-gold 1vmin, transparent 1vmin) calc(#{$green-w} + .7vmin) calc(#{$green-h} + 14.3vmin) / 2vmin 2vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $black 2.75vmin, transparent 1vmin) calc(#{$green-w} - .5vmin) calc(#{$green-h} + 12vmin) / 5.5vmin 6vmin no-repeat,
radial-gradient(ellipse at 50% 50%, darken($light-gold, 45%) 3vmin, transparent 1vmin) calc(#{$green-w} - .5vmin) calc(#{$green-h} + 11.5vmin) / 6vmin 6.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $light-gold .5vmin, darken($light-gold, 50%) 3.25vmin, transparent 1vmin) calc(#{$green-w}) calc(#{$green-h} + 11vmin) / 6.5vmin 7vmin no-repeat,
/* green highlights */
linear-gradient(-28deg, darken($green,5%) 1vmin, transparent 1vmin) calc(#{$green-w} + 2vmin) calc(#{$green-h} + 8vmin) / 3vmin 2vmin no-repeat,
linear-gradient(-27deg, transparent 4.5vmin, darken($green, 10%) 4.5vmin, $green 5.5vmin, transparent 5vmin)
calc(#{$green-w} + 4.75vmin) calc(#{$green-h} + 6.5vmin) / 7vmin 5vmin no-repeat,
linear-gradient(153deg, transparent 4.5vmin, darken($green, 10%) 4.5vmin, $green 8vmin, transparent 5vmin)
calc(#{$green-w} + 6.5vmin) calc(#{$green-h} + 7.5vmin) / 7vmin 12vmin no-repeat,
/* green base */
radial-gradient(ellipse at 50% 50%, $green 3.5vmin, transparent 1vmin) calc(#{$green-w} - .25vmin) calc(#{$green-h} + 10vmin) / 7vmin 8.75vmin no-repeat,
linear-gradient(140deg, $green 4.5vmin, transparent 1vmin) calc(#{$green-w} + 11vmin) calc(#{$green-h} + 6.5vmin) / 4vmin 6vmin no-repeat,
linear-gradient(-28deg, transparent 5vmin, $green 4vmin, $green 11vmin, transparent 5vmin) calc(#{$green-w} + 5vmin) calc(#{$green-h}) / 11vmin 18vmin no-repeat,
linear-gradient(-28deg, transparent 5vmin, $green 5vmin, $green 10.5vmin, transparent 5vmin) calc(#{$green-w} + 1.25vmin) calc(#{$green-h} - .75vmin) / 10vmin 18vmin no-repeat,
linear-gradient(-10deg, $green 4.5vmin, transparent 1vmin) calc(#{$green-w} + 11vmin) calc(#{$green-h} + 1vmin) / 6vmin 8vmin no-repeat,
linear-gradient(140deg, $green 4.5vmin, transparent 1vmin) calc(#{$green-w} + 15.75vmin) calc(#{$green-h} + 6.7vmin) / 4vmin 6vmin no-repeat,
}
$red-w: 35.5vmin;
$red-h: 46.25vmin;
/*** RED ***/
div.component:before {
width: 80vmin;
height: 70vmin;
transform: rotate(-18deg);
background:
/* gold */
radial-gradient(ellipse at 50% 50%, $dark-gold 1vmin, transparent 1vmin) calc(#{$red-w} - 3.75vmin) calc(#{$red-h} + 16.2vmin) / 2vmin 2vmin no-repeat,
linear-gradient(-23deg, transparent 2vmin, $dark-gold 2vmin, $dark-gold 4vmin, transparent 4vmin) calc(#{$red-w} - 3vmin) calc(#{$red-h} + 14.4vmin) / 5vmin 4vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $dark-gold 1vmin, transparent 1vmin) calc(#{$red-w} + .75vmin) calc(#{$red-h} + 14.2vmin) / 2vmin 2vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $black 2.75vmin, transparent 1vmin) calc(#{$red-w} - .5vmin) calc(#{$red-h} + 12vmin) / 5.5vmin 6vmin no-repeat,
radial-gradient(ellipse at 50% 50%, darken($light-gold, 45%) 3vmin, transparent 1vmin) calc(#{$red-w} - .5vmin) calc(#{$red-h} + 11.5vmin) / 6vmin 6.5vmin no-repeat,
radial-gradient(ellipse at 50% 50%, $light-gold .5vmin, darken($light-gold, 50%) 3.25vmin, transparent 1vmin) calc(#{$red-w}) calc(#{$red-h} + 11vmin) / 6.5vmin 7vmin no-repeat,
/* red highlights */
linear-gradient(-28deg, darken($red,5%) 1vmin, transparent 1vmin) calc(#{$red-w} + 2vmin) calc(#{$red-h} + 8vmin) / 3vmin 2vmin no-repeat,
linear-gradient(-27deg, transparent 4.5vmin, darken($red, 10%) 4.5vmin, $red 5.5vmin, transparent 5vmin) calc(#{$red-w} + 4.75vmin) calc(#{$red-h} + 6.5vmin) / 7vmin 5vmin no-repeat,
linear-gradient(153deg, transparent 4.5vmin, darken($red, 10%) 4.5vmin, $red 8vmin, transparent 5vmin)
calc(#{$red-w} + 6.5vmin) calc(#{$red-h} + 7.5vmin) / 7vmin 12vmin no-repeat,
/* red base */
radial-gradient(ellipse at 50% 50%, $red 3.5vmin, transparent 1vmin) calc(#{$red-w} - .25vmin) calc(#{$red-h} + 10vmin) / 7vmin 8.75vmin no-repeat,
linear-gradient(140deg, $red 4.5vmin, transparent 1vmin) calc(#{$red-w} + 11vmin) calc(#{$red-h} + 6.5vmin) / 4vmin 6vmin no-repeat,
linear-gradient(-28deg, transparent 5vmin, $red 4vmin, $red 11vmin, transparent 5vmin) calc(#{$red-w} + 5vmin) calc(#{$red-h}) / 11vmin 18vmin no-repeat,
linear-gradient(-28deg, transparent 5vmin, $red 5vmin, $red 10.5vmin, transparent 5vmin) calc(#{$red-w} + 1.25vmin) calc(#{$red-h} - .75vmin) / 10vmin 18vmin no-repeat,
linear-gradient(-10deg, $red 4.5vmin, transparent 1vmin) calc(#{$red-w} + 11vmin) calc(#{$red-h} + 1vmin) / 6vmin 8vmin no-repeat,
linear-gradient(140deg, $red 4.5vmin, transparent 1vmin) calc(#{$red-w} + 15.75vmin) calc(#{$red-h} + 6.6vmin) / 4vmin 6vmin no-repeat,
}
/* Greg Robleto
cssartstudio.com */
Also see: Tab Triggers