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.
#menu
h4 Main Site Navigation
#close
.fa.fa-times.fa-2x
span CLOSE
ul.group
li
a(href="") Pharetra Ultricies
li
a(href="") Commodo Dolor
li
a(href="") Pellentesque Condimentum
li
a(href="") Ipsum Mollis
li
a(href="") Ligula Amet
li
a(href="") Inceptos Sollicitudin
li
a(href="") Tellus Pharetra
li
a(href="") Malesuada Sollicitudin
li
a(href="") Magna Dolor
li
a(href="") Egestas Amet
footer
.fa.fa-twitter
.fa.fa-facebook
.fa.fa-instagram
p Customer Service: 800-123-4567
p
span.link Privacy Policy
span.line |
span.link Contact
span.line |
span.link Sponsors
span.line |
span.link Help
#content
header
.logo
i.fa.fa-globe.fa-4x
div WEBSITE
#menu-button
.icon
i.fa.fa-bars.fa-3x
i.fa.fa-arrows-alt
div MENU
.title
h2 Use the Menu
h3 Instead of a footer!
.text
p Cras mattis consectetur purus sit amet fermentum. Nullam id dolor id nibh ultricies vehicula ut id elit. Donec id elit non mi porta gravida at eget metus. Nullam quis risus eget urna mollis ornare vel eu leo. Aenean lacinia bibendum
a(href="") nulla leo
| sed consectetur. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec id elit non mi porta gravida at eget metus. Aenean lacinia bibendum nulla sed consectetur.
p Donec sed odio dui. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec sed odio dui. Donec sed odio dui. Duis mollis, est non commodo luctus,
a(href="") nisi erat porttitor ligula
| , eget lacinia odio sem nec elit. Donec ullamcorper nulla non metus auctor fringilla. Nullam id dolor id nibh ultricies vehicula ut id elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.
p.pullquote Donec sed odio dui. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Donec ullamcorper nulla non metus auctor fringilla. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Aenean lacinia bibendum nulla sed consectetur. Donec sed odio dui.
p Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Donec sed odio dui. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Nullam quis risus eget urna mollis ornare vel eu leo. Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam id dolor id nibh ultricies vehicula ut id elit. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
p Donec sed odio dui. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec sed odio dui. Donec sed odio dui. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non metus auctor fringilla. Nullam id dolor id nibh ultricies vehicula ut id elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.
#sizer
$sans: 'PT Sans', sans-serif
$sans-narrow: 'PT Sans Narrow', sans-serif
$tan: #E5E1D1
$brown: #303030
$red: #E0393D
$darkblue: #253746
$lightblue: #425563
//https://meyerweb.com/eric/tools/css/reset/
//v2.0 | 20110126
//License: none (public domain)
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video
margin: 0
padding: 0
border: 0
font-size: 100%
font: inherit
vertical-align: baseline
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section
display: block
body
line-height: 1
ol, ul
list-style: none
blockquote, q
quotes: none
blockquote:before, blockquote:after,
q:before, q:after
content: ''
content: none
table
border-collapse: collapse
border-spacing: 0
.group:after
content: ""
display: table
clear: both
*
box-sizing: border-box
-webkit-box-sizing: border-box
-moz-box-sizing: border-box
#sizer
position: fixed
bottom: 0
background-color: #444
height: 25px
width: 100%
color: white
text-shadow: 0 -1px 0 black
text-align: center
font-size: .8rem
line-height: 25px
// +-+-+-+-+-+-+-+- End CSS Reset +-+-+-+-+-+-+-+-
body, html
position: relative
width: 100%
height: 100%
h2
color: $darkblue
font-size: 3rem
font-family: $sans-narrow
h3
color: $lightblue
.text a
color: $brown
display: inline-block
position: relative
text-decoration: none
&:hover
color: $red
&:after
content: ""
width: 100%
height: 0px
position: absolute
bottom: 0
display: block
border-bottom: 2px solid $red
p
margin: 10px 0
line-height: 1.25
&.pullquote
width: 90%
margin: auto
padding: 0 20px
margin: 20px 0
position: relative
border-left: 2px solid $red
body
background-color: $tan
background-image: url(https://subtlepatterns.com/patterns/halftone.png)
color: $brown
font-family: $sans
font-size: 16px
#content
header
background-color: white
background-color: rgba(255,255,255,.5)
box-shadow: 0 5px 10px rgba(0,0,0,.15)
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.15)
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.15)
-o-box-shadow: 0 5px 10px rgba(0,0,0,.15)
text-align: center
position: relative
border-bottom: 1px solid $lightblue
h3
margin-top: 1%
.logo
width: 20%
height: 150px
padding-top: 25px
display: inline-block
background: $darkblue
color: $tan
vertical-align: top
position: absolute
left: 0
z-index: 2
@media all and (max-width: 599px)
float: left
width: 50%
height: 100px
padding-top: 18px
.fa
font-size: 48px
#menu-button
width: 20%
height: 150px
padding-top: 35px
display: inline-block
border-left: 1px solid $lightblue
position: absolute
right: 0
cursor: pointer
@media all and (max-width: 599px)
width: 50%
border-bottom: 1px solid $lightblue
height: 100px
padding-top: 18px
.icon
height: 48px
overflow: hidden
.fa
display: block
position: relative
transition: all .2s
-webkit-transition: all .2s
-moz-transition: all .2s
margin: 0
&.fa-arrows-alt
font-size: 44px
&:hover .fa-bars
margin-top: -48px
.title
width: 50%
height: 150px
display: inline-block
padding-top: 40px
@media all and (max-width: 599px)
width: 100%
height: auto
padding: 20px 5px
margin-top: 100px
.text
padding: 5%
max-width: 800px
margin: auto
#menu
background: rgba(66,85,99,.98)
position: absolute
top: 0
right: 0
width: 0
height: 0
opacity: 0
z-index: 1
text-align: center
transition: all .5s
overflow: hidden
@media all and (max-width: 599px)
padding-bottom: 50px
&.open
width: 100%
height: auto
min-height: 100%
opacity: 1
overflow: auto
h4
color: $tan
font-size: 24px
margin-top: 200px
@media all and (max-width: 599px)
margin-top: 120px
#close
width: 20%
height: 150px
position: absolute
top: 0
right: 0
color: $tan
text-align: center
padding-top: 25px
cursor: pointer
@media all and (max-width: 599px)
width: 50%
padding-top: 8px
height: 100px
.fa
display: block
line-height: 60px
ul
display: block
width: 90%
max-width: 800px
margin: auto
margin-top: 50px
border-top: 1px solid rgba(37,55,70,.5)
@media all and (max-width: 599px)
margin-top: 20px
li
display: inline-block
width: 50%
float: left
color: $tan
line-height: 60px
border-bottom: 1px solid rgba(37,55,70,.5)
@media all and (max-width: 599px)
width: 100%
line-height: 40px
&:nth-of-type(even)
border-left: 1px solid rgba(37,55,70,.5)
@media all and (max-width: 599px)
border-left: none
a
text-decoration: none
display: block
width: 100%
height: 100%
color: $tan
&:hover
background-color: $lightblue
footer
margin-top: 50px
color: $tan
p:first-of-type
margin: 20px 0
.fa
width: 50px
height: 50px
line-height: 50px
border-radius: 9999px
border: 1px solid rgba(37,55,70,.5)
.line
color: $darkblue
display: inline-block
margin: 0 20px
$(window).resize(function() {
$('body').append('<div id="sizer">' + $(window).width() + 'px x ' + $(window).height() + ' px</div>');
});
$('#menu-button').click(function(){
$("#menu").addClass('open');
});
$('#close').click(function() {
$('#menu').removeClass('open');
});
Also see: Tab Triggers