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="admin">
<header class="admin__header">
<a href="#" class="logo">
<h1>Dashboard</h1>
</a>
<div class="toolbar">
<div class="toolbar__left">
<button class="btn btn--primary">Add content</button>
</div>
<div class="toolbar__right">
<a href="#" class="btn btn--primary logout">Log Out</a>
</div>
</div>
</header>
<nav class="admin__nav">
<ul class="menu">
<li class="menu__title">Dashboard</li>
<li class="menu__item">
<a class="menu__link" href="#">Dashboard</a>
</li>
<li class="menu__item">
<a class="menu__link" href="#">Performance</a>
</li>
<!-- <li class="menu__divider"></li> -->
<li class="menu__title">Content</li>
<li class="menu__item">
<a class="menu__link" href="#">Media</a>
</li>
<li class="menu__item">
<a class="menu__link" href="#">Templates</a>
</li>
<!-- <li class="menu__divider"></li> -->
<li class="menu__title">Network</li>
<li class="menu__item">
<a class="menu__link is-active" href="#">Players</a>
</li>
<li class="menu__item">
<a class="menu__link" href="#">Channels</a>
</li>
<li class="menu__item">
<a class="menu__link" href="#">Domains</a>
</li>
<!-- <li class="menu__divider"></li> -->
<li class="menu__title">Account</li>
<li class="menu__item">
<a class="menu__link" href="#">Account Details</a>
</li>
<li class="menu__item">
<a class="menu__link" href="#">Account Settings</a>
</li>
<!-- <li class="menu__divider"></li> -->
<li class="menu__title">Help</li>
<li class="menu__item">
<a class="menu__link" href="#">Documentation</a>
</li>
<li class="menu__item">
<a class="menu__link" href="#">Changelogs</a>
</li>
</ul>
</nav>
<main class="admin__main">
<div class="dashboard">
<div class="dashboard__item">
<div class="card">
<div class="card__header">
Players
</div>
<div class="card__content">
<div class="card__item">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Beatae ab libero consectetur et numquam a id. Dignissimos nesciunt aperiam ut minima itaque repudiandae architecto praesentium autem. Porro ad labore fugiat?
</div>
</div>
</div>
</div>
<div class="dashboard__item dashboard__item--col">
<div class="card">
<div class="card__header">
Memory
</div>
<div class="card__content">
<div class="card__item">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium labore id culpa sit nisi nostrum, excepturi cumque eos laborum ducimus alias, provident doloribus et facere explicabo ab repudiandae perferendis earum.
</div>
</div>
</div>
</div>
<div class="dashboard__item dashboard__item--col">
<div class="card">
<div class="card__header">
Disk usage
</div>
<div class="card__content">
<div class="card__item">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium labore id culpa sit nisi nostrum, excepturi cumque eos laborum ducimus alias, provident doloribus et facere explicabo ab repudiandae perferendis earum.
</div>
</div>
</div>
</div>
<div class="dashboard__item dashboard__item--full">
<div class="card">
<div class="card__header">
Card full width
</div>
<div class="card__content">
<div class="card__item">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium labore id culpa sit nisi nostrum, excepturi cumque eos laborum ducimus alias, provident doloribus et facere explicabo ab repudiandae perferendis earum. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima dolore laudantium est, vel illo labore nostrum cupiditate perspiciatis, doloremque sit enim sequi, quasi cumque dolorum voluptate! Aliquam corrupti laboriosam nostrum. Lorem, ipsum dolor sit amet consectetur adipisicing elit. Assumenda cupiditate porro dolores optio dicta tempora quas, culpa itaque, unde recusandae tempore. Voluptas quia perferendis est veritatis nobis, iusto voluptate dolor?
</div>
</div>
</div>
</div>
<div class="dashboard__item dashboard__item--col">
<div class="card">
<div class="card__header">
Card
</div>
<div class="card__content">
<div class="card__item">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium labore id culpa sit nisi nostrum, excepturi cumque eos laborum ducimus alias, provident doloribus et facere explicabo ab repudiandae perferendis earum.
</div>
</div>
</div>
</div>
<div class="dashboard__item dashboard__item--col">
<div class="card">
<div class="card__header">
Card
</div>
<div class="card__content">
<div class="card__item">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium labore id culpa sit nisi nostrum, excepturi cumque eos laborum ducimus alias, provident doloribus et facere explicabo ab repudiandae perferendis earum.
</div>
</div>
</div>
</div>
<div class="dashboard__item dashboard__item--col">
<div class="card">
<div class="card__header">
Card
</div>
<div class="card__content">
<div class="card__item">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium labore id culpa sit nisi nostrum, excepturi cumque eos laborum ducimus alias, provident doloribus et facere explicabo ab repudiandae perferendis earum.
</div>
</div>
</div>
</div>
<div class="dashboard__item dashboard__item--col">
<div class="card">
<div class="card__header">
Card
</div>
<div class="card__content">
<div class="card__item">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium labore id culpa sit nisi nostrum, excepturi cumque eos laborum ducimus alias, provident doloribus et facere explicabo ab repudiandae perferendis earum.
</div>
</div>
</div>
</div>
<div class="dashboard__item dashboard__item--full">
<div class="card">
<div class="card__header">
Card full width
</div>
<div class="card__content">
<div class="card__item">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium labore id culpa sit nisi nostrum, excepturi cumque eos laborum ducimus alias, provident doloribus et facere explicabo ab repudiandae perferendis earum. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima dolore laudantium est, vel illo labore nostrum cupiditate perspiciatis, doloremque sit enim sequi, quasi cumque dolorum voluptate! Aliquam corrupti laboriosam nostrum. Lorem, ipsum dolor sit amet consectetur adipisicing elit. Assumenda cupiditate porro dolores optio dicta tempora quas, culpa itaque, unde recusandae tempore. Voluptas quia perferendis est veritatis nobis, iusto voluptate dolor?
</div>
</div>
</div>
</div>
<div class="dashboard__item dashboard__item--full">
<div class="card">
<div class="card__header">
Card full width
</div>
<div class="card__content">
<div class="card__item">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Laudantium labore id culpa sit nisi nostrum, excepturi cumque eos laborum ducimus alias, provident doloribus et facere explicabo ab repudiandae perferendis earum. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima dolore laudantium est, vel illo labore nostrum cupiditate perspiciatis, doloremque sit enim sequi, quasi cumque dolorum voluptate! Aliquam corrupti laboriosam nostrum. Lorem, ipsum dolor sit amet consectetur adipisicing elit. Assumenda cupiditate porro dolores optio dicta tempora quas, culpa itaque, unde recusandae tempore. Voluptas quia perferendis est veritatis nobis, iusto voluptate dolor?
</div>
</div>
</div>
</div>
</div>
</main>
<footer class="admin__footer">
<span>© 2018 Company Inc.</span>
<span><a href="#1" class="help">Ask for help</a></span>
</footer>
</div>
// Static Variables
$admin-header-height: 80px;
$admin-footer-height: 40px;
$admin-nav-width: 300px;
// Variables
:root {
--bg-color: #e5e5e5;
--bcn-orange: #f16a2d;
--bcn-orange-light: #f9ae56;
--bcn-orange-dark: #d96129;
--black: #333;
--white: #f5f5f5;
--text-color: #555;
--border-color: rgb(238,238,238);
--border-style: 1px solid var(--border-color);
}
// Global CSS
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
height: 100%;
overflow-x: hidden;
}
// Main Layout Grid
.admin {
--spacing: 1rem;
// Flexbox Fallback
display: flex;
flex-wrap: wrap;
// Grid
display: grid;
height: 100vh;
grid-template-rows: $admin-header-height 1fr $admin-footer-height;
grid-template-columns: $admin-nav-width 1fr;
grid-template-areas:
"header header"
"nav main"
"footer footer";
&__header {
display: flex;
flex-basis: 100%;
grid-area: header;
height: $admin-header-height;
background-color: #fff;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
position: relative;
}
&__nav {
flex: 0 0 $admin-nav-width;
grid-area: nav;
background-color: #313541;
}
&__main {
flex: 1;
grid-area: main;
padding: var(--spacing);
overflow-y: auto;
overflow-x: hidden;
-webkit-overflow-scrolling: touch;
background-color: var(--bg-color);
}
&__footer {
display: flex;
grid-area: footer;
flex-basis: 100%;
justify-content: space-between;
align-items: center;
height: $admin-footer-height;
padding: 0 var(--spacing);
color: #4e5561;
background-color: #1d2127;
}
@media screen and (min-width: 48rem) {
--spacing: 2rem;
}
}
// Dashboard Overview Grid
.dashboard {
--column-count: 2;
// Flexbox Fallback
display: flex;
flex-wrap: wrap;
margin: 0 calc(var(--spacing) * -0.5);
// Grid
display: grid;
grid-template-columns: repeat(var(--column-count), 1fr);
grid-gap: var(--spacing);
&__item {
// By default, items span 2 columns
flex: 1 1 50%;
grid-column-end: span 2;
padding: calc(var(--spacing) / 2);
// these span the full width
&--full {
flex-basis: 100%;
grid-column: 1 / -1;
}
// these span only one column
&--col {
flex-basis: calc(100% / var(--column-count));
grid-column-end: span 1;
}
}
// Switch to 4-col grid on larger screens
@media screen and (min-width: 48rem) {
--column-count: 4;
}
// If we have grid support, reset the margins and paddings;
// grid-gap handles the spacing for us.
@supports (display: grid) {
margin: 0;
&__item {
padding: 0;
}
}
}
// ===============================
// Demo stuff to make it look nice
// ===============================
a {
color: #dc5a60;
text-decoration: none;
}
img {
max-width: 100%;
height: auto;
}
.logo {
display: flex;
flex: 0 0 $admin-nav-width;
height: $admin-header-height;
justify-content: center;
align-items: center;
position: relative;
margin: 0;
color: #fff;
background-color: var(--bcn-orange);
font-size: 1rem;
h1 {
margin: 0;
}
}
.toolbar {
display: flex;
flex: 1;
justify-content: space-between;
align-items: center;
padding: 0 var(--spacing);
}
.menu {
list-style-type: none;
padding: 0;
&__title {
display: block;
padding: 2rem 2rem .5rem;
color: #76808f;
font-weight: 700;
}
&__divider::before {
content: "";
display: block;
width: calc(100% - 60px);
height: 2px;
margin: 30px 30px 40px;
background-color: #76808f;
}
&__item {
}
&__link {
display: block;
padding: 10px 30px;
color: #76808f;
text-decoration: none;
&.is-active {
color: #fff;
background-color: var(--bcn-orange-dark);
border-left: 3px solid var(--bcn-orange);
}
&:hover,
&:focus {
color: currentcolor;
background-color: var(--bcn-orange-light);
}
}
}
.card {
height: 100%;
font-weight: 300;
background-color: #fff;
border: 1px solid #e6eaee;
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
&__header {
padding: 20px 30px;
border-bottom: 1px solid #e6eaee;
font-weight: 700;
}
&__item {
padding: 20px 30px;
}
}
.btn {
display: inline-block;
border-radius: 5em;
border: 0;
padding: 0.5rem 1rem;
white-space: nowrap;
&--primary {
color: #fff;
background-color: #56bf89;
}
}
// No JS
Also see: Tab Triggers