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.
<div id=wrapper>
<div id=iphone>
<div id=shadow></div>
<div id=side></div>
<div id=lines>
<div>
<div>
<div></div>
</div>
</div>
<div>
<div>
<div></div>
</div>
</div>
</div>
<div id=toggler>
<div></div>
</div>
<div id=aux></div>
<div id=lightning></div>
<div id=bottom-speaker>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div id=skrews>
<div></div>
<div></div>
</div>
<div id=volume>
<div></div>
<div></div>
</div>
<div id=front>
<div id=front-cover></div>
<div id=camera>
<div></div>
</div>
<div id=speaker></div>
<div id=screen>
<div id=reminder>
<div></div>
<div> H e l l o</div>
<div>now</div>
</div>
<div id=circle></div>
<div id=time><div id=clock>
<div id=hours></div>
<div id=minutes></div>
<div id=seconds></div>
</div></div>
<div id=date>Code - Pen </div>
<div id=bottom></div>
<div id=top></div>
<div id=slide>
<div></div>
<p>slide to unlock</p>
</div>
<div id=signal>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div id=battery>
<div>86%</div>
<div>
<div></div>
<div></div>
</div>
</div>
</div>
<div id=home>
<div><div class=pulse></div>
</div><menu>
<li><a href=#><span aria-hidden=true class="fa fa-home" style=color:white></a></li>
<li><span aria-hidden=true class="fa fa-phone" style=color:white></a></li>
<li><span aria-hidden=true class="fa fa-cogs" style=color:white></a></li>
<li><span aria-hidden=true class="fa fa-envelope" style=color:white></a></li>
<li><span aria-hidden=true class="fa fa-globe" style=color:white></a></li>
<li><span aria-hidden=true class="fa fa-shopping-cart" style=color:white></a></li>
</menu>
</div>
</div>
</div>
</div>
</div>
@font-face {
font-family: Helvetica;
src: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/164210/HelveticaNeue-UltraLight.otf) format('TrueType');
font-weight: 500
}
::-webkit-scrollbar{width: 8px;}::-webkit-scrollbar-track{background: #7F8C8D;}::-webkit-scrollbar-thumb{background: #7F8C8D;}::-webkit-scrollbar-thumb:hover{background: #fff;}
body {
font-family: 'Helvetica', sans-serif;
background: #7f8c8d;
color: #333;
letter-spacing: 1px;
transform: translateZ(1px);
}
#wrapper {
height: 520px;
width: 800px;
margin-left: -700px;
margin-top: 300px;
position: absolute;
perspective: 6000px;
top: 50%;
left: 50%
}
#iphone {4
height: 760px;
width: 372px;
border-radius: 50px;
position: absolute;
background: 0;
box-shadow: none;
left: 206px;
top: -140px;
transform: rotateX(54deg) rotateZ(-46deg);
transform-style: preserve-3d
}
#side {
background: #cdd0d5;
width: 393px;
height: 780px;
border-top-left-radius: 77px;
border-bottom-left-radius: 49px;
border-bottom-right-radius: 86px;
border-top-right-radius: 70px;
position: absolute;
top: 5px;
left: -26px;
box-shadow: inset #3d3e42 0 0 15px 9px
}
#front {
width: 362px;
height: 750px;
border-radius: 49px;
position: absolute;
background-image: -webkit-linear-gradient(-27deg, #444, #000 10%, #000 42%, #333, #000 57%, #000 91%, #444);
left: 5px;
top: 5px;
box-shadow: inset #000 0 0 0 4px, #555 0 0 3px 0, #222 -3px 2px, #000 -5px 5px, #E0E0E0 -7px 6px 1px, #6D6D6D -7px 6px 9px;
transform: translateZ(1px)
}
#front-cover {
width: 344px;
height: 734px;
background: #000;
border-radius: 39px;
position: absolute;
top: 8px;
left: 9px
}
#home {
position: absolute;
width: 52px;
height: 52px;
border-radius: 50%;
background: linear-gradient(32deg, #666, #000, #666);
top: 684px;
left: 160px
}
#home div {
background: #000;
border-radius: 50%;
width: 46px;
height: 46px;
position: absolute;
left: 3px;
top: 3px
}
#camera {
width: 11px;
height: 11px;
background: #000;
position: absolute;
top: 35px;
left: 124px;
border-radius: 50%;
box-shadow: inset #666 -5px 2px 9px -2px
}
#camera div {
width: 6px;
height: 6px;
background: radial-gradient(#E1E4F5, #0D2B69 33%);
background-position: -1px -1px;
position: absolute;
top: 3px;
left: 3px;
border-radius: 50%
}
#speaker {
width: 50px;
height: 4px;
border-radius: 2px;
background: #555;
position: absolute;
top: 39px;
left: 156px;
box-shadow: inset #222 0 0 4px
}
#volume {
height: 128px;
width: 11px;
border-radius: 10px;
position: absolute;
background: #f9f9fa;
top: 171px;
left: -20px;
transform: rotateY(95deg);
transform-style: preserve-3d;
box-shadow: inset #292a2f 4px 0 8px 1px, #D5D5D5 -1px 0 2px
}
#volume div {
width: 8px;
height: 55px;
background: #bbbcc0;
border-radius: 10px;
position: absolute;
box-shadow: #eee -1px 1px, #777 -1px 3px, #505057 -3px 3px, inset #909197 -3px 0 3px
}
#volume div:first-child {
top: 2px;
left: 4px
}
#volume div:last-child {
top: 69px;
left: 4px
}
#toggler {
height: 34px;
width: 8px;
border-radius: 10px;
position: absolute;
background: #2b2c31;
top: 105px;
left: -20px;
transform: rotateY(95deg);
transform-style: preserve-3d;
box-shadow: inset #292a2f 4px 0 8px 1px, #D5D5D5 -1px 0 2px
}
#toggler div {
width: 4px;
height: 31px;
background: #bbbcc0;
border-radius: 10px;
position: absolute;
box-shadow: #eee -1px 1px, #777 -2px 3px, #505057 -3px 3px, inset #909197 -3px 0 3px;
top: -1px;
left: 3px
}
#aux {
width: 19px;
height: 19px;
background: #3b3b3b;
border-radius: 50%;
transform: rotateX(90deg) translateZ(1px);
transform-style: preserve-3d;
position: absolute;
top: 766px;
left: 45px;
box-shadow: inset #000 6px -3px 10px 1px, #C7C7C7 1px 0 1px
}
#lightning {
width: 48px;
height: 12px;
border-radius: 10px;
background: #3f3f3f;
transform: rotateX(90deg) translate3d(0px, 1px, 0px);
top: 771px;
position: absolute;
left: 139px;
box-shadow: inset #8e8f94 -1px 1px 0 2px, #515258 0 0 0 1px, inset #000 0 -3px 10px, #DADADA 1px 0 0 1px
}
#bottom-speaker {
position: absolute;
transform: rotateX(90deg);
top: 781px;
left: 70px
}
#bottom-speaker div {
width: 8px;
height: 8px;
border-radius: 50%;
background: #6c6d72;
position: absolute;
box-shadow: inset #000 1px -1px 4px 1px, #DADADA 1px 0
}
#bottom-speaker div:nth-child(2) {
left: 150px
}
#bottom-speaker div:nth-child(3) {
left: 162px
}
#bottom-speaker div:nth-child(4) {
left: 174px
}
#bottom-speaker div:nth-child(5) {
left: 186px
}
#bottom-speaker div:nth-child(6) {
left: 198px
}
#bottom-speaker div:nth-child(7) {
left: 210px
}
#skrews {
position: absolute;
top: 780px;
left: 120px;
transform: rotateX(90deg)
}
#skrews div {
position: absolute;
width: 8px;
height: 8px;
background: #5f5c5c;
border-radius: 50%;
top: 0;
z-index: 4;
box-shadow: inset #999aa0 0 0 0 2px, #444 1px 0
}
#skrews div:last-child {
left: 70px
}
#lines {
position: absolute;
top: 82px;
left: -32px
}
#lines>div:last-child {
top: 634px
}
#lines div {
width: 7px;
height: 11px;
position: absolute;
transform-style: preserve-3d;
transform-origin: 100% 100%
}
#lines>div {
background: linear-gradient(right, #393A3C, #5A595E);
transform: rotateY(90deg)
}
#lines>div>div {
background: linear-gradient(right, #5A595E, #87868A);
transform: rotateY(17deg);
left: -6px
}
#lines>div>div>div {
background: linear-gradient(right, #87868A, #A8A6AD);
transform: rotateY(17deg);
left: -6px
}
#shadow {
width: 350px;
height: 755px;
background: black;
position: absolute;
top: 5px;
left: 0;
transform: translateZ(-17px);
transform-style: preserve-3d;
box-shadow: #000 0 0 10px 15px;
opacity: .4;
border-top-left-radius: 76px;
border-top-right-radius: 200px;
border-bottom-left-radius: 40px;
border-bottom-right-radius: 56px
}
#screen {
background: linear-gradient(#A1E5E5, #1987AA);
width: 336px;
height: 589px;
position: absolute;
top: 80px;
left: 13px;
font-weight: 300;
color: #fff;
background-size: 200% 100%;
overflow: hidden
}
#time {
font-size: 86px;
left: 57px;
top: 37px;
position: absolute
}
#date {
font-size: 30px;
left: 85px;
top: 310px;
position: absolute
}
#bottom {
width: 37px;
height: 7px;
border-radius: 5px;
background: #2ab1db;
position: absolute;
top: 573px;
left: 149px
}
#top {
width: 37px;
height: 7px;
border-radius: 5px;
background: #d7ffff;
position: absolute;
top: 10px;
left: 149px
}
#slide {
position: absolute;
top: 489px;
left: 88px;
font-size: 28px;
color: #2ab1db;
background: linear-gradient(left, #2EC4F3 30%, #fff, #2EC4F3 70%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-size: 350px;
animation: slide 5s linear infinite;
font-size: 15px
}
@keyframes slide {
0% {
background-position: 100px 0
}
40% {
background-position: 440px 0
}
100% {
background-position: 440px 0
}
}
#slide div {
transform: rotate(135deg);
border-left: 2px solid #2ab1db;
border-top: 2px solid #2ab1db;
width: 15px;
height: 15px;
position: absolute;
left: -29px;
top: 10px
}
#signal {
position: absolute;
top: 9px;
left: 7px
}
#signal div {
width: 6px;
height: 6px;
border-radius: 50%;
background: #fff;
border: 1px solid #fff;
position: absolute
}
#signal div:nth-child(2) {
left: 9px
}
#signal div:nth-child(3) {
left: 18px
}
#signal div:nth-child(4) {
left: 27px
}
#signal div:nth-child(5) {
left: 36px;
background: 0
}
#battery {
position: absolute;
top: 3px;
left: 270px;
font-size: 13px
}
#battery>div:last-child {
width: 27px;
height: 9px;
border: 1px solid #fff;
position: absolute;
top: 4px;
left: 27px;
border-radius: 2px
}
#battery div div:first-child {
width: 21px;
height: 7px;
background: #fff;
position: absolute;
top: 1px;
left: 1px
}
#battery div div:last-child {
width: 1px;
height: 6px;
background: #FFF;
position: absolute;
left: 29px;
top: 2px;
border-radius: 0 1px 1px 0
}
#reminder {
position: absolute;
top: 400px;
left: 40px;
width: 296px;
height: 50px;
border-top: 1px solid #86e2f0;
border-bottom: 1px solid #86e2f0;
line-height: 50px;
font-weight: 400;
opacity: 0;
animation: reminder .1s linear forwards 5s
}
#reminder div:first-child {
background: #fff;
width: 16px;
height: 16px;
border-radius: 3px;
position: absolute;
top: 18px
}
#reminder div:nth-child(2) {
position: absolute;
left: 30px
}
#reminder div:last-child {
position: absolute;
left: 251px;
font-size: 11px;
color: #86e2f0
}
@keyframes reminder {
100% {
opacity: 1
}
}
#awwwards {
position: absolute;
bottom: 30px;
left: 70px
}
#awwwards a {
color: #444;
text-decoration: none;
border-bottom: 1px solid #888
}
#coolors {
position: absolute;
bottom: 30px;
right: 30px;
color: #444;
text-decoration: none;
border-bottom: 1px solid #888;
animation: coolors 1s infinite;
opacity: 1
}
@keyframes coolors {
50% {
right: 40px
}
}
#clock {
box-sizing: border-box;
width: 225px;
height: 225px;
border: 35px solid #a1e5e5;
border-radius: 50%;
margin: 0 auto;
-webkit-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg)
}
#clock:after {
content: "";
display: block;
position: absolute;
top: 50%;
left: 50%;
background: black;
border: 12px solid #a1e5e5;
border-radius: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%)
}
#hours,
#minutes,
#seconds {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0
}
#hours:after,
#hours:after,
#hours:after,
#minutes:after,
#minutes:after,
#minutes:after,
#seconds:after,
#seconds:after,
#seconds:after {
content: "";
display: block;
margin: 50% 50%;
width: 50%;
-webkit-transform-origin: left top;
-ms-transform-origin: left top;
transform-origin: left top;
-webkit-animation: clock linear infinite;
animation: clock linear infinite
}
#hours:after {
width: 30%;
outline: 4px solid #a1e5e5;
-webkit-animation-duration: 86400s;
animation-duration: 86400s
}
#minutes:after {
width: 40%;
outline: 3px solid #a1e5e5;
-webkit-animation-duration: 3600s;
animation-duration: 3600s
}
#seconds:after {
width: 48%;
outline: 2px solid #a1e5e5;
-webkit-animation-duration: 60s;
animation-duration: 60s
}
@-webkit-keyframes clock {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg)
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg)
}
}
@keyframes clock {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg)
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg)
}
}
.pulse {
position: absolute;
display: block;
width: 10px;
height: 10px;
background: #a1e5e5;
border-radius: 50%;
top: 80px;
left: 90px;
margin-left: 15px;
margin-top: 15px
}
.pulse:before,
.pulse:after {
content: "";
position: absolute;
box-sizing: border-box;
width: 10px;
height: 10px;
border: 1px solid #a1e5e5;
border-radius: 50%
}
.pulse:before {
-webkit-animation: blip1 1s infinite cubic-bezier(0, 0.6, 1, 0.6);
animation: blip1 1s infinite cubic-bezier(0, 0.6, 1, 0.6)
}
.pulse:after {
-webkit-animation: blip2 1s infinite linear;
animation: blip2 1s infinite linear
}
@-webkit-keyframes blip1 {
to {
-webkit-transform: scale(3);
transform: scale(3);
opacity: 0
}
}
@keyframes blip1 {
to {
-webkit-transform: scale(3);
transform: scale(3);
opacity: 0
}
}
@-webkit-keyframes blip2 {
to {
-webkit-transform: scale(2);
transform: scale(2);
opacity: 0
}
}
@keyframes blip2 {
to {
-webkit-transform: scale(2);
transform: scale(2);
opacity: 0
}
}
menu {
-webkit-transition: all .25s ease-in-out;
transition: all .25s ease-in-out;
-webkit-transition-delay: .75s;
transition-delay: .75s;
-ms-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
background-color: transparent;
margin: -45px 0 0 -45px;
position: absolute;
width: 90px;
height: 90px;
border-radius: 50%;
cursor: pointer;
left: 50%;
top: 50%
}
menu:before,
menu:after {
content: "";
z-index: 2;
position: absolute;
width: 3px;
height: 22.5px;
cursor: pointer;
background-color: transparent;
top: 50%;
left: 50%
}
menu:before {
-ms-transform: translate(-50%, -50%) rotate(-90deg);
-webkit-transform: translate(-50%, -50%) rotate(-90deg);
transform: translate(-50%, -50%) rotate(-90deg)
}
menu:after {
-ms-transform: translate(-50%, -50%) rotate(0deg);
-webkit-transform: translate(-50%, -50%) rotate(0deg);
transform: translate(-50%, -50%) rotate(0deg)
}
menu li {
-webkit-transition: all .25s ease-in-out;
transition: all .25s ease-in-out;
-webkit-transition-delay: .75s;
transition-delay: .75s;
width: 59.4px;
height: 59.4px;
margin: -29.7px 0 0 -29.7px;
opacity: 0;
text-align: center;
font-size: 18px;
font-family: Helvetica, sans-serif;
font-weight: 100;
line-height: 59.4px;
color: #fbfdff;
border-radius: 50%;
background-color: #1987aa;
list-style-type: none;
position: absolute;
z-index: 1;
left: 50%;
top: 50%
}
menu li li:nth-of-type(1) {
-ms-transform: rotate(0deg) translate(0, 0);
-webkit-transform: rotate(0deg) translate(0, 0);
transform: rotate(0deg) translate(0, 0)
}
menu li li:nth-of-type(2) {
-ms-transform: rotate(60deg) translate(0, 0);
-webkit-transform: rotate(60deg) translate(0, 0);
transform: rotate(60deg) translate(0, 0)
}
menu li li:nth-of-type(3) {
-ms-transform: rotate(120deg) translate(0, 0);
-webkit-transform: rotate(120deg) translate(0, 0);
transform: rotate(120deg) translate(0, 0)
}
menu li li:nth-of-type(4) {
-ms-transform: rotate(180deg) translate(0, 0);
-webkit-transform: rotate(180deg) translate(0, 0);
transform: rotate(180deg) translate(0, 0)
}
menu li li:nth-of-type(5) {
-ms-transform: rotate(240deg) translate(0, 0);
-webkit-transform: rotate(240deg) translate(0, 0);
transform: rotate(240deg) translate(0, 0)
}
menu li li:nth-of-type(6) {
-ms-transform: rotate(300deg) translate(0, 0);
-webkit-transform: rotate(300deg) translate(0, 0);
transform: rotate(300deg) translate(0, 0)
}
menu:hover {
-ms-transform: rotate(180deg);
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
-webkit-transition-delay: 0s;
transition-delay: 0s
}
menu:hover li {
-webkit-transition-delay: 0s;
transition-delay: 0s;
opacity: 1
}
menu:hover li:nth-of-type(1) {
-ms-transform: rotate(-180deg) translate(0, -90px);
-webkit-transform: rotate(-180deg) translate(0, -90px);
transform: rotate(-180deg) translate(0, -90px)
}
menu:hover li:nth-of-type(2) {
-ms-transform: rotate(-120deg) translate(0, -90px);
-webkit-transform: rotate(-120deg) translate(0, -90px);
transform: rotate(-120deg) translate(0, -90px)
}
menu:hover li:nth-of-type(3) {
-ms-transform: rotate(-60deg) translate(0, -90px);
-webkit-transform: rotate(-60deg) translate(0, -90px);
transform: rotate(-60deg) translate(0, -90px)
}
menu:hover li:nth-of-type(4) {
-ms-transform: rotate(0deg) translate(0, -90px);
-webkit-transform: rotate(0deg) translate(0, -90px);
transform: rotate(0deg) translate(0, -90px)
}
menu:hover li:nth-of-type(5) {
-ms-transform: rotate(60deg) translate(0, -90px);
-webkit-transform: rotate(60deg) translate(0, -90px);
transform: rotate(60deg) translate(0, -90px)
}
menu:hover li:nth-of-type(6) {
-ms-transform: rotate(120deg) translate(0, -90px);
-webkit-transform: rotate(120deg) translate(0, -90px);
transform: rotate(120deg) translate(0, -90px)
}
set("hours",30*new Date().getHours());set("minutes",6*new Date().getMinutes());set("seconds",10*new Date().getSeconds());function set(g,h){var e=document.getElementById(g),f="rotate("+h+"deg)";e.style.transform=f;e.style.webkitTransform=f};
Also see: Tab Triggers