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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
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.
If the stylesheet 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 CSS 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.
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.
.container
input(type="checkbox" id="control")
label(id="main-menu" for="control")
.share.top
.toplayer
.share.mid
.toplayer
.share.bottom
.toplayer
.icon-container
i(class="fa fa-github fa-4x icon-3d")
.section.one
.section.two
.section.three
.section.four
a(href="#" class="hover-toggle")
.icon-container
i(class="fa fa-twitter fa-4x icon-3d")
.section.one
.section.two
.section.three
.section.four
a(href="#" class="hover-toggle")
.icon-container
i(class="fa fa-instagram fa-4x icon-3d")
.section.one
.section.two
.section.three
.section.four
a(href="#" class="hover-toggle")
.icon-container
i(class="fa fa-whatsapp fa-4x icon-3d")
.section.one
.section.two
.section.three
.section.four
a(href="#" class="hover-toggle")
.icon-container
i(class="fa fa-facebook fa-4x icon-3d")
.section.one
.section.two
.section.three
.section.four
a(href="#" class="hover-toggle" id="final")
$primary: #2F6EA1
$secondary: #E06D59
$background: #ccc
$button: #ffffff
$cardTransition: .5s
$cardTransitionTwo: 1s
$cardDelay: .2s
@mixin sections($rotateX, $rotateY, $translateZ, $transformOrigin)
transform-origin: $transformOrigin
transform: rotateX($rotateX + deg) rotateY($rotateY + deg) translateZ($translateZ + px)
.icon-3d
color: white
position: absolute
left: 10px
top: 5px
z-index: 200
transition: $cardTransition
body
background: lighten($secondary, 10%)
height: 110vh
width: 100vw
display: flex
justify-content: center
align-items: center
.container
position: relative
top: -20px
.hover-toggle, label
height: 75px
width: 75px
background: white
margin-bottom: 1px
cursor: pointer
background: $primary
border: 3px solid #884F47
.border
position: absolute
transform-origin: center center
width: calc(100% - 12px)
height: calc(100% - 12px)
border: 2px solid white
top: 4px
left: 4px
label
display: block
position: absolute
transition: 1s
z-index: 100
&:hover
background: lighten($primary, 10%)
.share
position: absolute
height: 9px
width: 9px
background: $primary
border-radius: 100%
border: 2px solid white
z-index: 100
.toplayer
height: 9px
width: 9px
position: absolute
background: $primary
z-index: 100
border-radius: 100%
.top
z-index: 500
right: 15px
top: 13px
animation: move 3s linear forwards infinite
@keyframes move
25%
transform: translateX(-27px) translateY(-2px)
50%
transform: translateX(-27px) translateY(-2px)
75%
transform: translateX(0px) translateY(0px)
.bottom
bottom: 17px
right: 15px
animation: move2 3s linear forwards infinite
@keyframes move2
25%
transform: translateX(-27px) translateY(0px)
50%
transform: translateX(-27px) translateY(0px)
transform: translateX(-27px) translateY(-2px)
75%
transform: translateX(0px) translateY(0px)
.mid
top: 28px
left: 15px
animation: switch 3s linear forwards infinite
z-index: 100
&:before
content: ''
position: absolute
height: 2px
width: 24px
background: white
transform: rotate(28deg)
top: 12px
left: 8px
animation: switch2 3s linear forwards infinite
z-index: -10
&:after
content: ''
position: absolute
transform: rotate(-25deg)
width: 0px
height: 2px
width: 24px
top: -4px
left: 8px
background: white
animation: switch3 3.0s linear forwards infinite
z-index: -10
@keyframes switch
25%
transform: translateX(34px)
50%
transform: translateX(34px)
75%
transform: translateX(0px)
@keyframes switch2
25%
transform: translateX(-28px) translateY(2px) rotate(150deg)
50%
transform: translateX(-28px) translateY(2px) rotate(150deg)
75%
transform: translateY(0px) translateX(0px) rotate(28deg)
@keyframes switch3
25%
transform: translateX(-28px) translateY(-3px) rotate(-150deg)
50%
transform: translateX(-28px) translateY(-3px) rotate(-150deg)
75%
transform: translateY(0px) translateX(0px) rotate(-25deg)
.bottomTwo
bottom: 14px
left: 15px
.icon-container
cursor: pointer
position: absolute
transition: $cardTransitionTwo
opacity: 0
height: 75px
width: 75px
perspective: 1000px
.hover-toggle
position: absolute
display: block
height: 75px
width: 75px
input
display: none
position: absolute
z-index: 100
input:checked ~ label
border-top-right-radius: 100px
border-top-left-radius: 100px
transition: $cardTransitionTwo
transition-delay: $cardDelay
transform: translateY(-290%)
@for $i from 3 through 7
input:checked ~ .icon-container:nth-child(#{$i})
$y: (87 * $i) - 410
$delay: 40 * $i
opacity: 1
transform: translateY(($y + px))
transition: $cardTransitionTwo
transition-delay: $delay + ms
.section
position: absolute
height: 50%
width: 50%
z-index: 200
.section:hover ~ .hover-toggle
transition: $cardTransition
background: lighten($primary, 10%)
.one
top: 0px
left: 0px
&:hover ~ .hover-toggle
+sections(11, -11, 0, bottom right)
.two
top: 0px
right: 0px
&:hover ~ .hover-toggle
+sections(11, 11, 0, bottom left)
.three
bottom: 0px
left: 0px
&:hover ~ .hover-toggle
+sections(-11, -11, 0, top right)
.four
bottom: 0px
right: 0px
&:hover ~ .hover-toggle
+sections(-11, 11, 0, bottom left)
.icon-container > #final
border-bottom-right-radius: 100px
border-bottom-left-radius: 100px
.icon-container:nth-child(7) > .icon-3d
left: 20px
top: 10px
.icon-container:active > .icon-3d
transform: scale(.8)
Also see: Tab Triggers