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.
body
div.btn-bg.bg-1
.btn.btn-1
h2 ocean
button(href='#')
| click on me!
div.btn-bg.bg-2
.btn.btn-2
h2 leaf
button(href='#')
| It Growth
div.btn-bg.bg-3
.btn.btn-3
h2 Sand
button(href='#')
| flow away
div.btn-bg.bg-4
.btn.btn-4
h2 Fire
button(href='#')
| on the flame
div.btn-bg.bg-5
.btn.btn-5
h2 Windy
button(href='#')
| raining drop
div.btn-bg.bg-6
.btn.btn-6
h2 mamba
button(href='#')
a
| long night
div.btn-bg.bg-1
.btn.btn-1
h2 If you like it
a(href='http://lichin.me')
button
| view my Blog!
@import url(https://fonts.googleapis.com/css?family=Lato:400,100,300,700,100italic,300italic,400italic,700italic,900,900italic);
@import url(https://fonts.googleapis.com/css?family=Raleway:400,700);
aqur-color = #C7F8F9
aqur-bg = #6AB1C9
grass-color = #D0F9C7
grass-bg = #78C98D
sand-color = #F6F7C5
sand-bg = #E5D272
fire-color = #EDA39A
fire-bg = #ED6A5A
fire-active=#ED412A
cloud-color=#C4C0C0
cloud-bg = #ffffff
witch-color=#D3B7F7
witch-bg=#AC7EE5
witch-active=#8460AF
body
padding 0
margin 0
.btn-bg
width 100%
height 50vh
display flex
flex-direction column
align-items center
justify-content center
&.bg-1
background aqur-bg
.btn-1
button
color aqur-color
background transparent
border 3px solid aqur-color
border-radius 5px
-webkit-transition all .5s ease
transition all .5s ease
-webkit-transform translate(0, 0)
transform translate(0, 0)
a
color aqur-color
&:hover
background aqur-color
color aqur-bg
border 3px solid aqur-bg
-webkit-transition all .35s ease
transition all .35s ease
>a
color aqur-bg
-webkit-transition all .35s ease
transition all .35s ease
&:active
-webkit-transform translate(5px, 5px)
transform translate(5px, 5px)
&.bg-2
background grass-bg
.btn-2
button
color grass-bg
background grass-color
border none
-webkit-transition all .7s ease
transition all .7s ease
&:hover
background transparent
color grass-color
&:before , &:after
-webkit-transition all .7s ease
transition all .7s ease
width 100%
&:before , &:after
content ''
position absolute
top 0
left 0px
width 0px
height 3px
background grass-color
transition all .4s ease
&:after
top inherit
left inherit
bottom 0
right 0
&.bg-3
background sand-bg
.btn-3
button
color sand-bg
background sand-color
border none
-webkit-transition all 1s ease
transition all 1s ease
&:hover
-webkit-transition all .7s ease
transition all .7s ease
background transparent
color sand-color
&:after
transition all .3s ease
width 100%
left 0
&:after
position absolute
transition all .3s ease
content ''
width 0
bottom 0
left inherit
right 0
height 3px
background sand-color
&.bg-4
background fire-bg
.btn-4
button
color fire-color
border-radius 5px
background radial-gradient(circle,fire-active 0.25em, transparent 0.25em) center/1.2em 1.2em
border 3px solid fire-active
-webkit-transition all .3s ease
transition all .3s ease
&:hover
color white
background radial-gradient(circle, fire-active 0.25em, transparent 0.25em) center/0.1em 0.1em
-webkit-transition all .5s ease
transition all .5s ease
&.bg-5
background cloud-bg
.btn-5
h2
color cloud-color
button
color cloud-color
background transparent
border 3px solid cloud-color
border-radius 5px
-webkit-transition all .25s ease
transition all .25s ease
&:hover
border-color #50514f
color #50514f
background-image repeating-linear-gradient(-25deg, cloud-color, cloud-color 3px, transparent 4px, transparent 7px)
background-size 12px 16px
-webkit-animation cloud-animation 1.25s infinite ease
animation cloud-animation 1.25s infinite ease
-webkit-animation-delay 0
-webkit-transition all .25s ease
transition all .25s ease
&.bg-6
background witch-bg
.btn-6
button
width 11em
height 3em
color witch-color
background transparent
border 3px solid witch-color
border-radius 5px
-webkit-transition border 0.5s ease-out
transition border 0.5s ease-out
transition-delay .8s
a
position absolute
z-index 2
left 43px
top 17px
&::before,&::after
position absolute
top 0
left 0
right 0
bottom 0
margin auto
content 'LONG NIGHT'
border-radius 50%
display block
width 22em
height 22em
left -5.5em
text-align center
-webkit-transition box-shadow .5s ease-out
transition box-shadow .5s ease-out
transition-delay .75s
-webkit-transition-delay .75s
z-index 1
&::after
transition-delay .25s
-webkit-transition-delay .25s
&:hover
color white
border-color witch-active
animation witch-word-color 1.5s ease
-webkit-transition border .2s ease
transition border .2s ease
&::before
box-shadow inset 0 0 0 11em #B657E5
transition-delay .05s
&::after
box-shadow inset 0 0 0 11em witch-active
transition-delay .5s
@keyframes cloud-animation
100%
background-position 0px 2em
@keyframes witch-word-color
0%
color witch-color
50%
color #50514f
100%
color white
.btn
margin 0 auto 30px auto
//overflow hidden
display block
h2
text-align center
font-family 'Raleway'
font-weight 600
color white
//text-transform uppercase
button
cursor pointer
overflow hidden
outline none
color #fff
position relative
letter-spacing 0.1em
font-weight 400
padding 1rem 3rem 1rem 3rem
text-transform uppercase
font-family "Lato"
font-size 1.5em
a
text-decoration none
Also see: Tab Triggers