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 class="screen">
<header>
<a class="target-burger">
<ul class="buns">
<li class="bun"></li>
<li class="bun"></li>
</ul>
<!--buns-->
</a>
<!--target-burger-->
</header>
<nav class="main-nav" role="navigation">
<ul>
<li><a href=""><span>My Account</span></a></li>
<li><a href=""><span>Billing Information</span></a></li>
<li><a href=""><span>Order Tracker</span></a></li>
<li><a href=""><span>Change Password</span></a></li>
<li><a href=""><span>Log Out</span></a></li>
</ul>
</nav>
<!--main-nav-->
<div class="container">
<div class="app-content">
<ul class="content-list">
<li>
<article>
<figure>
<img src="https://unsplash.imgix.net/photo-1428930377079-45a584b6dd6b?dpr=2&fit=crop&fm=jpg&h=1575&q=75&w=1050" alt="The Jim Lewis Dalaman Briefcase">
<figcaption>
<span class="category">Accessories</span>
<h1>Eli DeFaria Dalaman</h1>
<span class="price"> £255</span>
</figcaption>
</figure>
</article>
</li>
</ul>
<!--content-list-->
</div>
<!--app-content-->
</div>
<!--contaienr-->
</div>
<!--screen-->
/*! normalize.css v1.0.0 | MIT License | git.io/normalize */
/* =============================================================================
HTML5 display definitions
========================================================================== */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
display: block;
}
audio,
canvas,
video {
display: inline-block;
*display: inline;
*zoom: 1;
}
audio:not([controls]) {
display: none;
}
[hidden] {
display: none;
}
/* =============================================================================
Base
========================================================================== */
/*
* 1. Correct text resizing oddly in IE6/7 when body font-size is set using em units
* 2. Force vertical scrollbar in non-IE
* 3. Prevent iOS text size adjust on device orientation change, without disabling user zoom: h5bp.com/g
*/
*,
*:before,
*:after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-o-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
html,
body {
height: 100%;
}
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
body {
margin: 0;
padding: 0;
}
input[type=button],
input[type=submit],
input[type=text],
input[type=search],
input[type=password],
select,
button,
textarea {
margin: 0;
cursor: pointer;
outline: none;
vertical-align: top;
}
input[type=submit] {
border: none 0;
-webkit-appearance: none;
-webkit-border-radius: 0px;
}
input[type=radio],
input[type=checkbox] {
margin: 0;
padding: 0;
}
input[type=text],
input[type=search],
select,
textarea {
cursor: default;
}
button {
border: none 0;
}
*:first-child + html input.button {
overflow: visible;
/* remove padding from left/right */
width: auto !important;
}
/*
* Remove text-shadow in selection highlight: h5bp.com/i
* These selection declarations have to be separate
* Also: hot pink! (or customize the background color to match your design)
*/
::selection {
color: #fff;
background-color: #328efd;
}
::-moz-selection {
color: #fff;
background-color: #328efd;
}
a {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
a:hover,
a:focus,
a:active {
text-decoration: none;
}
a:hover,
a:active {
outline: 0;
text-decoration: none;
}
/* =============================================================================
Typography
========================================================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0;
padding: 0;
}
blockquote {
margin: 1em 40px;
}
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0;
padding: 0;
}
/* =============================================================================
Lists
========================================================================== */
ul,
ol {
margin: 0;
padding: 0;
}
ul {
list-style: none;
}
dd {
margin: 0 0 0 40px;
}
nav ul,
nav ol {
list-style: none;
margin: 0;
padding: 0;
}
/* =============================================================================
Embedded content
========================================================================== */
/*
* Improve image quality when scaled in IE7
* code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/
*/
img {
border: 0;
-ms-interpolation-mode: bicubic;
}
/*
* Correct overflow displayed oddly in IE9
*/
svg:not(:root) {
overflow: hidden;
}
/* =============================================================================
Figures
========================================================================== */
figure {
margin: 0;
}
/* =============================================================================
Forms
========================================================================== */
form {
margin: 0;
}
fieldset {
border: 0;
margin: 0;
padding: 0;
}
/* Indicate that 'label' will shift focus to the associated form element */
label {
cursor: pointer;
}
/*
* 1. Correct color not inheriting in IE6/7/8/9
* 2. Correct alignment displayed oddly in IE6/7
*/
legend {
border: 0;
*margin-left: -7px;
padding: 0;
}
/*
* 1. Correct font-size not inheriting in all browsers
* 2. Remove margins in FF3/4 S5 Chrome
* 3. Define consistent vertical alignment display in all browsers
*/
button,
input,
select,
textarea {
font-size: 100%;
margin: 0;
vertical-align: baseline;
*vertical-align: middle;
}
/* Select styling in Firefox */
@-moz-document url-prefix() {
select {
padding: 0.8em 0.75em;
}
}
/*
* 1. Define line-height as normal to match FF3/4 (set using !important in the UA stylesheet)
*/
button,
input {
line-height: normal;
}
*:first-child + html input.button {
overflow: visible;
/* remove padding from left/right */
width: auto !important;
}
/*
* 1. Display hand cursor for clickable form elements
* 2. Allow styling of clickable form elements in iOS
* 3. Correct inner spacing displayed oddly in IE7 (doesn't effect IE6)
*/
button,
input[type="button"],
input[type="reset"],
input[type="submit"] {
cursor: pointer;
-webkit-appearance: button;
*overflow: visible;
}
input[type=submit] {
-webkit-appearance: none;
-webkit-border-radius: 0px;
}
/*
* Consistent box sizing and appearance
*/
input[type="checkbox"],
input[type="radio"] {
margin: 0;
padding: 0;
}
input[type="search"] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/*
* Remove inner padding and border in FF3/4: h5bp.com/l
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/*
* 1. Remove default vertical scrollbar in IE6/7/8/9
* 2. Allow only vertical resizing
*/
textarea {
overflow: auto;
vertical-align: top;
resize: vertical;
}
/* Colors for form validity */
input:invalid,
textarea:invalid {
background-color: #f0dddd;
}
/* =============================================================================
Tables
========================================================================== */
table {
border-collapse: collapse;
border-spacing: 0;
}
/* =============================================================================
Non-semantic helper classes
Please define your styles before this section.
========================================================================== */
/* Hide from both screenreaders and browsers: h5bp.com/u */
.hidden {
display: none !important;
visibility: hidden;
}
/* Hide only visually, but have it available for screenreaders: h5bp.com/v */
.visuallyhidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
/* Extends the .visuallyhidden class to allow the element to be focusable when navigated to via the keyboard: h5bp.com/p */
.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus {
clip: auto;
height: auto;
margin: 0;
overflow: visible;
position: static;
width: auto;
}
/* Hide visually and from screenreaders, but maintain layout */
.invisible {
visibility: hidden;
}
/* Contain floats: h5bp.com/q */
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
/* #Typography Variables
================================================== */
/* #Colour Variables
================================================== */
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: 400;
src: local('Montserrat Regular'), local('Montserrat-Regular'), url(https://fonts.gstatic.com/s/montserrat/v12/JTUSjIg1_i6t8kCHKm459Wlhzg.ttf) format('truetype');
}
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: 700;
src: local('Montserrat Bold'), local('Montserrat-Bold'), url(https://fonts.gstatic.com/s/montserrat/v12/JTURjIg1_i6t8kCHKm45_dJE3gnD-w.ttf) format('truetype');
}
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 300;
src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url(https://fonts.gstatic.com/s/sourcesanspro/v11/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdr.ttf) format('truetype');
}
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 400;
src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v11/6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7g.ttf) format('truetype');
}
a {
text-decoration: none;
}
h1 {
font-size: 2.35em;
line-height: 1.25;
font-weight: 300;
}
/* =============================================================================
Layout
========================================================================== */
body {
font-size: 100%;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
font-family: 'Source Sans Pro', helvetica, sans-serif;
color: #333333;
line-height: 1.6;
font-weight: normal;
background-color: #3babf1;
}
.container {
position: relative;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.container.toggled {
-webkit-filter: blur(8px);
-moz-filter: blur(8px);
-o-filter: blur(8px);
-ms-filter: blur(8px);
filter: blur(8px);
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
div.screen {
margin: 0 auto;
width: 23.5em;
height: 35.25em;
overflow: hidden;
position: relative;
top: 10%;
background-color: #333333;
-webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.25);
-moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.25);
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.25);
}
div.screen nav.main-nav {
position: absolute;
left: 0;
top: 0;
z-index: 0;
height: 100%;
width: 100%;
padding: 2em;
-webkit-opacity: 0;
-moz-opacity: 0;
opacity: 0;
-webkit-transform: scale(0.85);
-ms-transform: scale(0.85);
transform: scale(0.85);
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
div.screen nav.main-nav.toggled {
display: block;
z-index: 10;
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
-webkit-opacity: 1;
-moz-opacity: 1;
opacity: 1;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
div.screen nav.main-nav ul {
padding: 2em 0 0 0;
}
div.screen nav.main-nav ul li {
border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
div.screen nav.main-nav ul li a {
font-size: 1.25em;
color: #fff;
padding: 1em 0;
font-weight: 300;
display: block;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
div.screen nav.main-nav ul li a:last-child {
border: none;
}
div.screen nav.main-nav ul li a:hover {
-webkit-opacity: 0.45;
-moz-opacity: 0.45;
opacity: 0.45;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
padding: 1em;
}
div.screen header {
position: absolute;
top: 0;
z-index: 15;
}
div.screen header a.target-burger {
margin: 1.125em;
width: 3.25em;
height: 3.25em;
position: absolute;
display: block;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
div.screen header a.target-burger:hover {
cursor: pointer;
-webkit-opacity: 0.45;
-moz-opacity: 0.45;
opacity: 0.45;
}
div.screen header a.target-burger.toggled ul.buns li.bun {
-webkit-transform: rotate(45deg) translateZ(0);
transform: rotate(45deg) translateZ(0);
}
div.screen header a.target-burger.toggled ul.buns li.bun:last-child {
-webkit-transform: rotate(-45deg) translateZ(0);
transform: rotate(-45deg) translateZ(0);
}
div.screen header a.target-burger ul.buns {
width: 1.625em;
height: 1.625em;
list-style: none;
margin: -0.8125em 0 0 -0.8125em;
padding: 0;
position: absolute;
top: 50%;
left: 50%;
-webkit-transition: -webkit-transform 1s cubic-bezier(0.23, 1, 0.32, 1), color 1s cubic-bezier(0.23, 1, 0.32, 1);
transition: transform 1s cubic-bezier(0.23, 1, 0.32, 1), color 1s cubic-bezier(0.23, 1, 0.32, 1);
-webkit-transform: translateZ(0);
transform: translateZ(0);
color: #fff;
}
div.screen header a.target-burger ul.buns li.bun {
width: 100%;
height: 2px;
background-color: #fff;
position: absolute;
top: 50%;
margin-top: -0.75px;
-webkit-transform: translateY(-3.75px) translateZ(0);
transform: translateY(-3.75px) translateZ(0);
-webkit-transition: -webkit-transform 1s cubic-bezier(0.23, 1, 0.32, 1), background-color 1s cubic-bezier(0.23, 1, 0.32, 1);
transition: transform 1s cubic-bezier(0.23, 1, 0.32, 1), background-color 1s cubic-bezier(0.23, 1, 0.32, 1);
}
div.screen header a.target-burger ul.buns li.bun:last-child {
-webkit-transform: translateY(3.75px) translateZ(0);
transform: translateY(3.75px) translateZ(0);
}
div.screen div.app-content {
position: relative;
z-index: 5;
}
div.screen div.app-content ul.content-list li article figure {
position: relative;
}
div.screen div.app-content ul.content-list li article figure:before {
content: '';
position: absolute;
z-index: 2;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.35);
}
div.screen div.app-content ul.content-list li article figure img {
width: 100%;
line-height: 1;
display: block;
}
div.screen div.app-content ul.content-list li article figure figcaption {
color: #fff;
position: absolute;
z-index: 5;
bottom: 0;
padding: 2em 2em 2.5em 2em;
}
div.screen div.app-content ul.content-list li article figure figcaption h1,
div.screen div.app-content ul.content-list li article figure figcaption span {
-webkit-text-shadow: 0px 0px 10px rgba(0, 0, 0, 0.25);
-moz-text-shadow: 0px 0px 10px rgba(0, 0, 0, 0.25);
text-shadow: 0px 0px 10px rgba(0, 0, 0, 0.25);
}
div.screen div.app-content ul.content-list li article figure figcaption h1 {
padding: 0 0 0.25em 0;
margin: 0 0 0.25em 0;
border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}
div.screen div.app-content ul.content-list li article figure figcaption span {
font-family: 'Montserrat', sans-serif;
display: block;
}
div.screen div.app-content ul.content-list li article figure figcaption span.category {
letter-spacing: 0.2em;
text-transform: uppercase;
font-size: 0.8em;
padding: 0 0 0.3em;
color: rgba(255, 255, 255, 0.7);
}
div.screen div.app-content ul.content-list li article figure figcaption span.price {
font-size: 1.3em;
float: right;
}
/* =============================================================================
Mixins & Functions
========================================================================== */
.inline-block {
display: inline-block;
*display: inline;
*zoom: 1;
}
//Custom JS
$(document).ready(function(){
$('a.target-burger').click(function(e){
$('div.container, nav.main-nav, a.target-burger').toggleClass('toggled');
e.preventDefault();
});//target-burger-click
});//doc-rdy
Also see: Tab Triggers