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 URL's 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 it's URL and the proper URL extention.
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 class="wrapper">
<div class="header">
<ul class="menu">
<li>News</li>
<li>Features</li>
<li>How it works</li>
<li>Blog</li>
</ul>
<div class="content">
<h2>Combine your Spotify, Soundcloud. iTunes, Deezer and YouTube into one giant music library</h2>
<div class="buttons">
<a class="button apple" href="#">App Store</a>
<a class="button google" href="#">Google play</a>
</div>
</div>
<img class="logo" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/626071/line-logo.svg">
<img class="curve" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/626071/bottom-curve_copy.svg">
<img class="waves" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/626071/waves_copy.svg">
</div>
</div>
<div class="background"></div>
body
width 100%
height 100%
min-height 100vh
margin 0
font-family 'Work Sans', sans-serif
font-weight 400
.background
width 100%
height 100%
min-height 100vh
position fixed
top 0
left 0
z-index -1
background rgb(167,65,255)
background -moz-linear-gradient(top, rgba(167,65,255,1) 0%, rgba(84,128,253,1) 100%)
background -webkit-linear-gradient(top, rgba(167,65,255,1) 0%,rgba(84,128,253,1) 100%)
background linear-gradient(to bottom, rgba(167,65,255,1) 0%,rgba(84,128,253,1) 100%)
.wrapper
width 80%
height 100%
min-height 800px
background #FFF
position absolute
left 50%
top 0
margin 60px 0
transform translate(-50%,0)
-webkit-transform translate(-50%,0)
-moz-transform translate(-50%,0)
-webkit-box-shadow 0px 0px 30px 5px rgba(0,0,0,0.15)
-moz-box-shadow 0px 0px 30px 5px rgba(0,0,0,0.15)
box-shadow 0px 0px 30px 5px rgba(0,0,0,0.15)
.header
width 100%
height 100%
position absolute
top 0
left 0
background rgb(129,162,255)
background -moz-linear-gradient(top, rgba(129,162,255,1) 0%, rgba(193,225,255,1) 100%)
background -webkit-linear-gradient(top, rgba(129,162,255,1) 0%,rgba(193,225,255,1) 100%)
background linear-gradient(to bottom, rgba(129,162,255,1) 0%,rgba(193,225,255,1) 100%)
overflow hidden
.logo
width 50px
height auto
position absolute
top 50px
left 100px
.menu
list-style none
margin 0
padding 0
line-height 33px
position absolute
top 50px
right 100px
text-align right
width auto
li
display inline-block
margin 0 10px
color #FFF
.content
position absolute
width 100%
height auto
max-width 800px
top 50%
left 50%
transform translate(-50%,-85%)
h2
color #FFF
margin 0
font-size 2.3em
line-height 1.2em
width 100%
text-align center
.buttons
width 100%
text-align center
margin 0
padding 0
.button
display inline-block
width 150px
height 50px
padding-left 20px
background #000
color #FFF
font-size 1.2em
text-decoration none
text-align center
line-height 50px
margin 40px 5px 0
-moz-border-radius 5px
-webkit-border-radius 5px
border-radius 5px
-webkit-box-shadow 0px 12px 20px -10px rgba(0,0,0,0.65)
-moz-box-shadow 0px 12px 20px -10px rgba(0,0,0,0.65)
box-shadow 0px 12px 20px -10px rgba(0,0,0,0.65)
transition box-shadow 0.5s
&:hover
-webkit-box-shadow 0px 0px 20px -10px rgba(0,0,0,0.65)
-moz-box-shadow 0px 0px 20px -10px rgba(0,0,0,0.65)
box-shadow 0px 0px 20px -10px rgba(0,0,0,0.65)
transition box-shadow 0.5s
&.apple
background-image url('http://vignette2.wikia.nocookie.net/respawnables/images/2/2f/Apple-logo-white-md.png/revision/latest?cb=20160224124036')
background-size 20px auto
background-repeat no-repeat
background-position 20px center
&.google
background-image url('http://vignette3.wikia.nocookie.net/starwars/images/e/ee/Google_Play_logo.png/revision/latest?cb=20141119230612')
background-size 20px auto
background-repeat no-repeat
background-position 20px center
.waves
width calc(100% + 10px)
height auto
position absolute
bottom -3px
left 50%
transform translate(-50%,0)
-webkit-transform translate(-50%,0)
-moz-transform translate(-50%,0)
z-index 0
.curve
display none
width calc(100% + 10px)
height auto
position absolute
bottom -1px
left 50%
transform translate(-50%,0)
-webkit-transform translate(-50%,0)
-moz-transform translate(-50%,0)
z-index 1
Also see: Tab Triggers