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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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="app">
<div>
<div class="birthday-cake">
<div class="candle">
<div class="fire">
<div class="inner-fire"></div>
</div>
</div>
<div class="extra"></div>
<div class="cake">
<div class="top"></div>
</div>
<div class="base">
<div class="base-1"></div>
<div class="base-2"></div>
<div class="base-3"></div>
</div>
</div>
<p>
<a href="https://twitter.com/baumannzone">Baumannzone</a> ยท
<a href="https://github.com/baumannzone/pure-css-cake">GitHub</a>
</p>
</div>
</div>
base-color = #607d8b
base-border-color = darken(base-color, 15%)
cake-color = #f5f1dd
cake-lines-color = #cba15f
chocolate-color = #6b46c1
candle-color = #9e9e9e
fire-color = yellow
inner-fire-color = orange
body
background-color #a8ecc1
#app
display flex
justify-content center
font-family Avenir, Helvetica, Arial, sans-serif
-webkit-font-smoothing antialiased
-moz-osx-font-smoothing grayscale
margin-top 50px
p
margin-top 100px
text-align center
a
color chocolate-color
.birthday-cake
margin-top 50px
transform scale(.7)
@media (min-width: 465px) {
transform scale(1)
}
.candle
position relative
width 20px
height 80px
background-color candle-color
margin 0 auto
&:after
content ''
position absolute
top -12px
left calc(50% - 2px)
width 4px
height 12px
background-color #555
opacity .8
.fire
position absolute
opacity .7
background fire-color
width 40px
height 40px
margin-top -45px
transform rotate(45deg)
left calc(50% - 20px)
border-top-right-radius 30px
border-bottom-left-radius 30px
border-bottom-right-radius 30px
animation flaming 3s ease-in-out infinite;
.inner-fire
position relative
opacity .5
background inner-fire-color
width 20px
height 20px
top 14px
left 14px
border-top-right-radius 30px
border-bottom-left-radius 30px
border-bottom-right-radius 30px
animation flaming-inner 2s ease-out infinite;
.extra
margin 0 auto
background-color chocolate-color
width 220px
height 50px
border-top-left-radius 30px
border-top-right-radius 30px
.cake
position relative
width 400px
height 180px
margin 0 auto
border-top-left-radius 40px
border-top-right-radius 40px
background-color cake-color
&:after,
&:before
content ''
position absolute
width 400px
height 20px
background-color cake-lines-color
bottom 0
&:after
margin-bottom 30px
&:before
margin-bottom 70px
.top
position relative
width 400px
height 50px
border-top-left-radius 40px
border-top-right-radius 40px
background-color chocolate-color
&:before
content ''
position absolute
width 25px
height 45px
top 40px
border-bottom-left-radius 40px
border-bottom-right-radius 40px
background-color chocolate-color
box-shadow 50px -12px chocolate-color,
100px -7px chocolate-color,
150px 0 chocolate-color,
200px 10px chocolate-color,
250px -1px chocolate-color,
300px -10px chocolate-color,
350px 0px chocolate-color
&:after
content ''
position absolute
width 25px
height 45px
top 38px
left 25px
border-top-left-radius 50px
border-top-right-radius 50px
background-color cake-color
box-shadow 50px -15px cake-color,
100px -10px cake-color,
150px -7px cake-color,
200px -2px cake-color,
250px -5px cake-color,
300px -10px cake-color,
350px 0px cake-color
.base
.base-1
width 450px
height 30px
background-color base-color
border-top 5px solid base-border-color
border-bottom-left-radius 30px
border-bottom-right-radius 30px
.base-2
width 100px
height 50px
margin 0 auto
border-top 10px solid base-border-color
background-color base-color
.base-3
width 200px
height 30px
margin 0 auto
border-top-left-radius 10px
border-top-right-radius 10px
background-color base-color
@keyframes flaming {
50% {
transform: scaleY(.9) rotate(45deg) translate(3px, 3px)
}
}
@keyframes flaming-inner {
50% {
transform: scale(1.1) translate(-1px, -1px)
}
}
Also see: Tab Triggers