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="container">
<aside>
<div class="user">
<picture>
<img src="https://randomuser.me/api/portraits/men/79.jpg" alt="User photo">
</picture>
<div class="user__info">
<h4>Chris Warner</h4>
<p>Auckland, NZ</p>
</div>
</div>
<nav>
<ul>
<li>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-grid">
<path d="M3 3h7v7H3zM14 3h7v7h-7zM14 14h7v7h-7zM3 14h7v7H3z" /></svg>
<span>Dashboard</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-users">
<path d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2" />
<circle cx="9" cy="7" r="4" />
<path d="M23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75" /></svg>
<span>Members</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-database">
<ellipse cx="12" cy="5" rx="9" ry="3" />
<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3" />
<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5" /></svg>
<span>Database</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bar-chart">
<path d="M12 20V10M18 20V4M6 20v-4" /></svg>
<span>Statistics</span>
</li>
</ul>
</nav>
<div class="settings">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings">
<circle cx="12" cy="12" r="3" />
<path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-2 2 2 2 0 01-2-2v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83 0 2 2 0 010-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 01-2-2 2 2 0 012-2h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 010-2.83 2 2 0 012.83 0l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 012-2 2 2 0 012 2v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 0 2 2 0 010 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 012 2 2 2 0 01-2 2h-.09a1.65 1.65 0 00-1.51 1z" /></svg>
<span>Settings</span>
</div>
</aside>
<main>
<header>
<h4>Team Members</h4>
<p>7 Online Now</p>
<p>View all members</p>
</header>
<section>
<div class="card">
<img src="https://randomuser.me/api/portraits/women/65.jpg" alt="Authors photo" class="card__avatar">
<p class="card__name">Carrie Burton</p>
<p class="card__country">New Zealand</p>
<p class="card__article">New CSS properties min(), max(), and clamp()</p>
</div>
<div class="card">
<img src="https://randomuser.me/api/portraits/men/30.jpg" alt="Authors photo" class="card__avatar">
<p class="card__name">TK Samuels</p>
<p class="card__country">Australia</p>
<p class="card__article">Different Approaches to Responsive CSS Motion Path</p>
</div>
<div class="card">
<img src="https://randomuser.me/api/portraits/women/63.jpg" alt="Authors photo" class="card__avatar">
<p class="card__name">Rachel McKenna</p>
<p class="card__country">United Kingdom</p>
<p class="card__article">The Cost of Javascript Frameworks</p>
</div>
<div class="card">
<img src="https://randomuser.me/api/portraits/men/60.jpg" alt="Authors photo" class="card__avatar">
<p class="card__name">Stuart Neilson</p>
<p class="card__country">USA</p>
<p class="card__article">Creating Morphing Animations with CSS clip-path</p>
</div>
<div class="card">
<img src="https://randomuser.me/api/portraits/men/29.jpg" alt="Authors photo" class="card__avatar">
<p class="card__name">Jamie Forrest</p>
<p class="card__country">USA</p>
<p class="card__article">Updates to Form Controls and Focus</p>
</div>
<div class="card">
<img src="https://randomuser.me/api/portraits/women/62.jpg" alt="Authors photo" class="card__avatar">
<p class="card__name">Tania Jefferies</p>
<p class="card__country">France</p>
<p class="card__article">Create Diagonal Layouts Like It’s 2020</p>
</div>
</section>
</main>
</div>
@import url("https://fonts.googleapis.com/css?family=Lato&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
$lite-grey: #f1f1f1;
$dark-grey: #e7e7e7;
$pink: #e56586;
$white: #ffffff;
@mixin uc-ls-2 {
font-size: 0.7rem;
letter-spacing: 2px;
text-transform: uppercase;
font-weight: bold;
}
body {
height: 100vh;
background: $dark-grey;
font-family: "Lato", sans-serif;
display: grid;
place-items: center;
}
a {
text-decoration: none;
}
ul {
list-style: none;
}
.container {
width: 100%;
max-width: 1100px;
margin: auto;
border-radius: 10px;
display: grid;
grid-template-columns: 30% 1fr;
img {
width: 70px;
height: 70px;
border-radius: 50%;
}
}
aside,
main {
padding: 3em;
}
// SIDEBAR
aside {
background-color: #ff92b4;
background-image: linear-gradient(174deg, #ff92b4 0%, #e56586 100%);
font-size: 0.9rem;
color: $white;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
}
.user {
display: grid;
grid-template-columns: 40% 1fr;
align-items: center;
&__info {
h4 {
font-size: 1.1rem;
font-weight: normal;
letter-spacing: 1px;
margin-bottom: 7px;
}
p {
@include uc-ls-2();
}
}
}
nav {
@include uc-ls-2();
padding: 0 1em;
margin-top: 20%;
ul {
li {
display: grid;
grid-template-columns: 30px 1fr;
align-items: center;
padding: 16px 0;
cursor: pointer;
transition: 0.2s;
&:hover {
span {
color: $white;
}
svg {
stroke: $white;
}
}
svg {
width: 18px;
height: 18px;
}
}
li:nth-child(2) {
cursor: default;
}
li:not(:nth-child(2)) {
color: darken($white, 16);
}
}
}
.settings {
margin-top: 30%;
padding: 0 1em;
display: grid;
grid-template-columns: 30px 1fr;
align-items: center;
color: darken($white, 16);
@include uc-ls-2();
cursor: pointer;
transition: 0.2s;
&:hover {
span {
color: $white;
}
svg {
stroke: $white;
}
}
svg {
width: 18px;
height: 18px;
}
}
// MAIN
main {
background-color: $lite-grey;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
height: 100%;
}
header {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
padding: 1em 0;
h4 {
font-size: 1.2rem;
font-weight: normal;
grid-column: 1 / -1;
margin-bottom: 20px;
}
p {
@include uc-ls-2();
&:nth-child(2) {
color: darken($dark-grey, 30);
}
&:nth-child(3) {
color: $pink;
justify-self: end;
cursor: pointer;
&:hover {
color: inherit;
}
}
}
}
section {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
grid-auto-rows: 1fr;
grid-gap: 1em;
grid-auto-flow: dense;
}
.card {
width: 100%;
background-color: $white;
padding: 2em;
border-radius: 5px;
cursor: pointer;
transition: 0.3s;
&:hover {
box-shadow: 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}
&__avatar {
border-radius: 50%;
margin-bottom: 10px;
border: 1px solid $lite-grey;
}
&__name {
@include uc-ls-2();
color: $pink;
}
&__country {
color: darken($dark-grey, 30);
font-size: 0.8rem;
margin: 5px 0 20px;
}
&__article {
font-size: 0.9rem;
line-height: 1.4rem;
}
}
@media (max-width: 880px) {
.user {
grid-template-columns: 1fr;
justify-items: center;
}
nav {
padding: 0;
ul {
li {
grid-template-columns: 1fr;
justify-items: center;
svg {
margin-bottom: 10px;
}
}
}
}
.settings {
grid-template-columns: 1fr;
justify-items: center;
padding: 0;
svg {
margin-bottom: 10px;
}
}
}
@media (max-width: 680px) {
.container {
grid-template-columns: 16% 1fr;
}
aside,
main {
padding: 3em 5px;
}
main {
padding: 3em 1em;
}
.user {
&__info {
display: none;
}
}
nav {
ul {
li {
svg {
width: 24px;
height: 24px;
}
span {
display: none;
}
}
}
}
.settings {
svg {
width: 24px;
height: 24px;
}
span {
display: none;
}
}
}
/*
Design based on this Dribble shot by Ali Sayed
https://dribbble.com/shots/4194278-Conceptual-Dashboard-UI-Team-Members-Screen/attachments/958601
*/
Also see: Tab Triggers