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.
.home
p Home Page
.menu-trigger
.bars
span
span
span
p MENU
.menu
ul
li
p New Arrivals
li
p Woman
li
p Man
li
p Releases
li
p Stores
a.dribbble-link(href="https://dribbble.com/shots/5290735-ARKK-Menu-and-Category-page" target="_blank")
i.fab.fa-dribbble
@import url('https://fonts.googleapis.com/css?family=Abel')
*
box-sizing: border-box
body
width: 100vw
height: 100vh
font-family: Abel, Helvetica, sans-serif
.home
background: #222
width: 100%
height: 100%
display: flex
align-items: center
justify-content: center
> p
color: #fff
font-size: 2rem
text-transform: uppercase
.menu-trigger
position: fixed
top: 0
left: 0
width: 50px
height: 100%
cursor: pointer
display: flex
align-items: center
justify-content: center
z-index: 10
background: #222
&:hover
border-right: none
> .bars > span
&:first-of-type,
&:last-of-type
transform: translateY(-5px)
opacity: 0
&:nth-of-type(2)
transform: scaleY(1.2)
transform-origin: center bottom
> .menu
transform: translateX(50px)
> ul > li > p
transform: translateY(0)
> p
transform: translateY(40px) rotate(-90deg)
opacity: 1
> p
color: #aaa
transform: translateY(60px) rotate(-90deg)
margin-top: 30px
font-weight: bold
letter-spacing: .12rem
transition: all .4s ease
position: absolute
opacity: 0
font-size: .9rem
z-index: 10
.bars
display: flex
width: 50%
align-items: center
justify-content: space-between
z-index: 10
> span
width: 4px
height: 40px
background: #666
transition: all .4s ease
.menu
position: absolute
top: 0
left: 0
background: #222
height: 100%
border-right: 1px solid #444
transform: translateX(calc(-100% + 51px))
transition: all .8s cubic-bezier(.785,.135,.15,.86)
padding: 50px 100px 50px 50px
will-change: transform
> ul
&:hover
> li:not(:hover)
color: rgba(#f9f9ed, .5)
> li
color: #f9f9ed
font-size: 2rem
cursor: pointer
padding: 10px 0
width: 160px
overflow: hidden
&:first-of-type
padding-top: 0
&:last-of-type
padding-bottom: 0
@for $i from 1 through 5
&:nth-of-type(#{$i}) > p
transition: transform .6s cubic-bezier(.785,.135,.15,.86) .1s * $i, color .2s ease
> p
transform: translateY(calc(100% + 10px))
.dribbble-link
position: fixed
bottom: 20px
right: 20px
background: #E04982
width: 50px
height: 50px
border-radius: 50%
display: flex
align-items: center
justify-content: center
text-decoration: none
&:before
content: 'View original post on Dribbble'
position: absolute
top: -85%
left: -150px
width: 180px
transition: all .4s ease
background: #fff
color: #222
border-radius: 5px
padding: 10px
transform: translateY(10px)
opacity: 0
z-index: -1
pointer-events: none
&:hover
&:before
transform: translateY(0)
opacity: 1
pointer-events: auto
z-index: 1
> i
color: #fff
font-size: 1.8rem
Also see: Tab Triggers