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="icon-wrapper">
<div class="icon burger">
<div class="bun-top"></div>
<div class="patty"></div>
<div class="bun-bottom"></div>
</div>
<div class="icon icon-chat">
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="chat" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M0,3 L0,24 L6,24 L6,32 L16.909,24 L31,24 L31,3 L0,3 Z M3,6 L28,6 L28,21 L16.909,21 L15.926,21 L15.134,21.581 L9,26.08 L9,24 L9,21 L6,21 L3,21 L3,6 Z" id="Fill-1" fill="#333"></path>
</g>
</svg>
<div class="chat-dot-1st"></div>
<div class="chat-dot-2nd"></div>
<div class="chat-dot-3rd"></div>
</div>
<div class="icon icon-user">
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="user" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M12,13 C12,10.794 13.794,9 16,9 C18.206,9 20,10.794 20,13 C20,15.206 18.206,17 16,17 C13.794,17 12,15.206 12,13 M20.701,18.175 C22.11,16.895 23,15.054 23,13 C23,9.134 19.866,6 16,6 C12.134,6 9,9.134 9,13 C9,15.054 9.89,16.895 11.299,18.175 C8.146,19.858 6,23.177 6,27 L9,27 C9,23.14 12.141,20 16,20 C19.859,20 23,23.14 23,27 L26,27 C26,23.177 23.854,19.858 20.701,18.175" id="Fill-1" fill="#333"></path>
</g>
</svg>
<div class="user-bling-1"></div>
<div class="user-bling-2"></div>
<div class="user-bling-3"></div>
</div>
<div class="icon icon-pen">
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="user" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M3.02215501,25.977845 L5.15914131,25.977845 L21.7260274,9.4109589 L19.5890411,7.2739726 L3.02215501,23.8408587 L3.02215501,25.977845 Z M4.4736881e-16,22.5890411 L19.5890411,3 L26,9.4109589 L6.4109589,29 L0,29 L4.4736881e-16,22.5890411 Z" id="Rectangle-5" fill="#333" fill-rule="nonzero"></path>
</g>
</svg>
<div class="line"></div>
</div>
<div class="icon icon-star">
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="star" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M7,14.5393179 L11.2020391,18.6369389 C11.3881988,18.8162428 11.4736318,19.079925 11.4298605,19.3330599 L10.4373608,25.1182468 L15.6318997,22.3864995 C15.8623579,22.2652057 16.1376421,22.2652057 16.3681003,22.3864995 L21.5621118,25.1182468 L20.5706668,19.3330599 C20.5263682,19.079925 20.6118012,18.8162428 20.7979609,18.6369389 L25,14.5393179 L19.1926638,13.695535 C18.9347826,13.6586195 18.7122349,13.4951365 18.5967421,13.2630962 L16,8 L13.4027306,13.2630962 C13.2872378,13.4951365 13.06469,13.6586195 12.8073362,13.695535 L7,14.5393179 Z M12.3813684,10.7259304 C12.3786886,10.7263148 12.3760104,10.7267039 12.3733335,10.7270978 L12.3813684,10.7259304 Z M11.2265795,10.8937156 L16.0002732,1.22032231 L18.6903606,6.67261166 L20.7729451,10.8936426 L31.4454294,12.4443123 L27.0944662,16.6871567 L23.7241812,19.9736282 L25.5458166,30.6030646 L20.1656503,27.7734107 L15.9999479,25.5824939 L6.45250945,30.6033803 L7.48055822,24.6109813 L8.27608376,19.9739505 L0.554570578,12.4443123 L6.56864129,11.5704916 L11.2265795,10.8937156 Z M19.6240225,10.7267087 L19.6332024,10.7280425 C19.6301443,10.7275915 19.6270843,10.7271469 19.6240225,10.7267087 Z M8.47372945,18.8218956 C8.47339367,18.8238374 8.4730605,18.8257794 8.47272996,18.8277215 L8.47372945,18.8218956 Z" id="4J" fill="#333" fill-rule="nonzero"></path>
</g>
</div>
</div>
body {
width: 100%;
height: 100%;
background: #03fe7f;
}
.icon-wrapper {
width: 100%;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
.icon {
margin: 0 20px;
}
}
// Burger ##########################
.burger {
position: relative;
width: 32px;
height: 32px;
cursor: pointer;
.bun-top,
.patty,
.bun-bottom {
position: absolute;
width: 32px;
height: 3px;
margin-left: 16px;
background: #333;
transition: transform .2s;
}
.bun-top {
transform: translate(-16px, 5px);
}
.patty {
transform: translate(-16px, 14px);
}
.bun-bottom {
transform: translate(-16px, 23px);
}
&:hover .bun-top {
transform: translate(-16px, 2px);
}
&:hover .bun-bottom {
transform: translate(-16px, 26px);
}
// Active state ####################
&.open .bun-top {
transform: translate(-16px, 14px) rotate(45deg);
}
&.open .patty {
opacity: 0;
}
&.open .bun-bottom {
transform: translate(-16px, 14px) rotate(-45deg);
}
}
// Chat ########################
.icon-chat {
position: relative;
width: 32px;
height: 32px;
cursor: pointer;
svg {
position: absolute;
}
.chat-dot-1st,
.chat-dot-2nd,
.chat-dot-3rd {
width: 3px;
height: 3px;
background: #333;
position: absolute;
top: 12px;
opacity: 0;
transition: opacity .2s;
}
.chat-dot-1st {
left: 8px;
transition-delay: .2s;
}
.chat-dot-2nd {
left: 14px;
transition-delay: .1s;
}
.chat-dot-3rd {
left: 20px;
transition-delay: 0s;
}
&:hover .chat-dot-1st,
&:hover .chat-dot-2nd,
&:hover .chat-dot-3rd {
opacity: 1;
}
&:hover .chat-dot-1st {
transition-delay: 0s;
}
&:hover .chat-dot-2nd {
transition-delay: .1s;
}
&:hover .chat-dot-3rd {
transition-delay: .2s;
}
}
// User ########################
.icon-user {
position: relative;
width: 32px;
height: 32px;
cursor: pointer;
svg {
position: absolute;
}
.user-bling-1,
.user-bling-2,
.user-bling-3 {
position: absolute;
opacity: 0;
width: 3px;
height: 6px;
background: #333;
transition: all .2s;
}
.user-bling-1 {
left: 7px;
top: 1px;
transform: rotate(-45deg);
}
.user-bling-2 {
left: 14px;
top: -1px;
}
.user-bling-3 {
left: 21px;
top: 1px;
transform: rotate(45deg);
}
&:hover .user-bling-1,
&:hover .user-bling-2,
&:hover .user-bling-3 {
opacity: 1;
}
&:hover .user-bling-1 {
left: 5px;
top: -1px;
}
&:hover .user-bling-2 {
left: 14px;
top: -4px;
}
&:hover .user-bling-3 {
left: 23px;
top: -1px;
}
}
// Pen ########################
.icon-pen {
position: relative;
width: 32px;
height: 32px;
cursor: pointer;
svg {
position: absolute;
transition: all .2s;
}
.line {
position: absolute;
width: 0px;
height: 3px;
top: 26px;
background: #333;
opacity: 0;
transition: all .2s;
}
&:hover svg {
transform: translate(21px, 0px);
}
&:hover .line {
width: 24px;
opacity: 1;
}
}
// Star ########################
.icon-star {
position: relative;
width: 32px;
height: 32px;
cursor: pointer;
svg {
position: absolute;
transition: all .2s;
}
&:hover svg {
transform: rotate(-73deg) scale(1.2);
}
}
$( "div.burger" ).click(function() {
$( this ).toggleClass( "open" );
});
Also see: Tab Triggers