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.
<header>
<div class="wrapper">
<div class="header__content">
<svg viewBox="0 0 24 24" fill="#2D64BC" class="mercado-match">
<path d="M20.5 2h-17A1.5 1.5 0 002 3.5v17A1.5 1.5 0 003.5 22h17a1.5 1.5 0 001.5-1.5v-17A1.5 1.5 0 0020.5 2zM8 19H5v-9h3zM6.5 8.25A1.75 1.75 0 118.3 6.5a1.78 1.78 0 01-1.8 1.75zM19 19h-3v-4.74c0-1.42-.6-1.93-1.38-1.93A1.74 1.74 0 0013 14.19a.66.66 0 000 .14V19h-3v-9h2.9v1.3a3.11 3.11 0 012.7-1.4c1.55 0 3.36.86 3.36 3.66z"></path>
</svg>
<div class="header__search"></div>
</div>
<div class="header__content header__buttons">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" data-supported-dps="24x24" fill="currentColor" class="mercado-match" width="24" height="24" focusable="false">
<path d="M23 9v2h-2v7a3 3 0 01-3 3h-4v-6h-4v6H6a3 3 0 01-3-3v-7H1V9l11-7 5 3.18V2h3v5.09z"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" data-supported-dps="24x24" fill="currentColor" class="mercado-match" width="24" height="24" focusable="false">
<path d="M12 16v6H3v-6a3 3 0 013-3h3a3 3 0 013 3zm5.5-3A3.5 3.5 0 1014 9.5a3.5 3.5 0 003.5 3.5zm1 2h-2a2.5 2.5 0 00-2.5 2.5V22h7v-4.5a2.5 2.5 0 00-2.5-2.5zM7.5 2A4.5 4.5 0 1012 6.5 4.49 4.49 0 007.5 2z"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" data-supported-dps="24x24" fill="currentColor" class="mercado-match" width="24" height="24" focusable="false">
<path d="M17 6V5a3 3 0 00-3-3h-4a3 3 0 00-3 3v1H2v4a3 3 0 003 3h14a3 3 0 003-3V6zM9 5a1 1 0 011-1h4a1 1 0 011 1v1H9zm10 9a4 4 0 003-1.38V17a3 3 0 01-3 3H5a3 3 0 01-3-3v-4.38A4 4 0 005 14z"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" data-supported-dps="24x24" fill="currentColor" class="mercado-match" width="24" height="24" focusable="false">
<path d="M16 4H8a7 7 0 000 14h4v4l8.16-5.39A6.78 6.78 0 0023 11a7 7 0 00-7-7zm-8 8.25A1.25 1.25 0 119.25 11 1.25 1.25 0 018 12.25zm4 0A1.25 1.25 0 1113.25 11 1.25 1.25 0 0112 12.25zm4 0A1.25 1.25 0 1117.25 11 1.25 1.25 0 0116 12.25z"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" data-supported-dps="24x24" fill="currentColor" class="mercado-match" width="24" height="24" focusable="false">
<path d="M22 19h-8.28a2 2 0 11-3.44 0H2v-1a4.52 4.52 0 011.17-2.83l1-1.17h15.7l1 1.17A4.42 4.42 0 0122 18zM18.21 7.44A6.27 6.27 0 0012 2a6.27 6.27 0 00-6.21 5.44L5 13h14z"></path>
</svg>
<div class="header__icon"></div>
</div>
</div>
</header>
<main>
<ul class="card">
<li class="notification">
<img class="notification__avatar" src="https://assets.codepen.io/240751/christina-wocintechchat-com-0Zx1bDv5BNY-unsplash.png" alt="" />
<div class="notification__body">
Congratulate <b>a near-stranger</b> for two years at <b>a job you didn't know they had</b>.
</div>
<div class="notification__interactive">
<div class="notification__time">1h</div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1.5rem" id="overflow-web-ios-medium" aria-hidden="true" role="none" data-supported-dps="24x24" fill="currentColor">
<path d="M14 12a2 2 0 11-2-2 2 2 0 012 2zM4 10a2 2 0 102 2 2 2 0 00-2-2zm16 0a2 2 0 102 2 2 2 0 00-2-2z"></path>
</svg>
</div>
<div></div>
<button class="notification__button">
Say congrats
</button>
</li>
<li class="notification">
<img class="notification__avatar blur" src="https://assets.codepen.io/240751/christina-wocintechchat-com-SJvDxw0azqw-unsplash.png" />
<div class="notification__body">
<b>Someone</b> looked at your profile! Who? We're holding that information for ransom.
</div>
<div class="notification__interactive">
<div class="notification__time">2h</div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1.5rem" id="overflow-web-ios-medium" aria-hidden="true" role="none" data-supported-dps="24x24" fill="currentColor">
<path d="M14 12a2 2 0 11-2-2 2 2 0 012 2zM4 10a2 2 0 102 2 2 2 0 00-2-2zm16 0a2 2 0 102 2 2 2 0 00-2-2z"></path>
</svg>
</div>
</li>
<li class="notification">
<img class="notification__avatar" src="https://assets.codepen.io/240751/alexander-hipp-iEEBWgY_6lA-unsplash.png" alt="" />
<div class="notification__body">
Follow <b>the worst coworker you've ever had</b> for their sudden unsolicited insights.
</div>
<div class="notification__interactive">
<div class="notification__time">8h</div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1.5rem" id="overflow-web-ios-medium" aria-hidden="true" role="none" data-supported-dps="24x24" fill="currentColor">
<path d="M14 12a2 2 0 11-2-2 2 2 0 012 2zM4 10a2 2 0 102 2 2 2 0 00-2-2zm16 0a2 2 0 102 2 2 2 0 00-2-2z"></path>
</svg>
</div>
</li>
<li class="notification">
<img class="notification__avatar" src="https://assets.codepen.io/240751/christina-wocintechchat-com-Zpzf7TLj_gA-unsplash.png" alt="" />
<div class="notification__body">
<b>Somebody</b> connected to <b>your first manager</b> from your job in 2014 reacted to <b>a former classmate</b>'s post. Thought you should know.
</div>
<div class="notification__interactive">
<div class="notification__time">1d</div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1.5rem" id="overflow-web-ios-medium" aria-hidden="true" role="none" data-supported-dps="24x24" fill="currentColor">
<path d="M14 12a2 2 0 11-2-2 2 2 0 012 2zM4 10a2 2 0 102 2 2 2 0 00-2-2zm16 0a2 2 0 102 2 2 2 0 00-2-2z"></path>
</svg>
</div>
</li>
<li class="notification">
<img class="notification__avatar" src="https://assets.codepen.io/240751/kate-bezzubets-UJbqowk5fso-unsplash.png" alt="" />
<div class="notification__body">
<b>A wannabe influencer</b> shared <b>an incredibly shitty opinion</b> just for the engagement. Click here to engage.
</div>
<div class="notification__interactive">
<div class="notification__time">2d</div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1.5rem" id="overflow-web-ios-medium" aria-hidden="true" role="none" data-supported-dps="24x24" fill="currentColor">
<path d="M14 12a2 2 0 11-2-2 2 2 0 012 2zM4 10a2 2 0 102 2 2 2 0 00-2-2zm16 0a2 2 0 102 2 2 2 0 00-2-2z"></path>
</svg>
</div>
<div></div>
<div class="shared-post">"Never hire anyone who can write CSS."</div>
<div></div>
<div></div>
<section class="social-counts">
<span>
9,246 Reactions
</span>
•
<span>
724 Comments
</span>
</section>
</li>
<li class="notification">
<img class="notification__avatar square" src="https://assets.codepen.io/240751/bf.png" alt="" />
<div class="notification__body">
<b>Destructive, monopolistic corporations</b> are hiring for <b>jobs that kinda sound like yours</b>. …Real estate developer is the same as software developer, right?
</div>
<div class="notification__interactive">
<div class="notification__time">1w</div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1.5rem" id="overflow-web-ios-medium" aria-hidden="true" role="none" data-supported-dps="24x24" fill="currentColor">
<path d="M14 12a2 2 0 11-2-2 2 2 0 012 2zM4 10a2 2 0 102 2 2 2 0 00-2-2zm16 0a2 2 0 102 2 2 2 0 00-2-2z"></path>
</svg>
</div>
</li>
<li class="notification">
<img class="notification__avatar square" src="https://assets.codepen.io/240751/1674590195758.jpg" alt="" />
<div class="notification__body">
You’re <b>one of a few experts</b> invited to <strike>do free unpaid labor</strike> add to this collaborative article: How do you exploit users without them noticing?
</div>
<div class="notification__interactive">
<div class="notification__time">1w</div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1.5rem" id="overflow-web-ios-medium" aria-hidden="true" role="none" data-supported-dps="24x24" fill="currentColor">
<path d="M14 12a2 2 0 11-2-2 2 2 0 012 2zM4 10a2 2 0 102 2 2 2 0 00-2-2zm16 0a2 2 0 102 2 2 2 0 00-2-2z"></path>
</svg>
</div>
</li>
<li class="notification">
<img class="notification__avatar" src="https://assets.codepen.io/240751/darceystone-photography-KmRM8RkL2ZI-unsplash.png" alt="" />
<div class="notification__body">
<b>Kris</b>, <b>Taylor</b>, and 36 others at <b>soul-sucking corporation</b> shared <b>this post from the CEO</b> in hopes of avoiding the next round of layoffs.
</div>
<div class="notification__interactive">
<div class="notification__time">2w</div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1.5rem" id="overflow-web-ios-medium" aria-hidden="true" role="none" data-supported-dps="24x24" fill="currentColor">
<path d="M14 12a2 2 0 11-2-2 2 2 0 012 2zM4 10a2 2 0 102 2 2 2 0 00-2-2zm16 0a2 2 0 102 2 2 2 0 00-2-2z"></path>
</svg>
</div>
<div></div>
<div class="shared-post">"We sucked more souls than ever in Q3, and we couldn't do it without our people!! We're truly family here! #LFG 🚀💸📈"</div>
<div></div>
<div></div>
<section class="social-counts">
<span>
715 Reactions
</span>
•
<span>
83 Comments
</span>
</li>
<li class="notification">
<img class="notification__avatar square" src="https://assets.codepen.io/240751/searches.png" alt="" />
<div class="notification__body">
<b>You appeared in 28 searches this week</b>. …Is that good? We have no idea either. Try Premium, maybe.
</div>
<div class="notification__interactive">
<div class="notification__time">3w</div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1.5rem" id="overflow-web-ios-medium" aria-hidden="true" role="none" data-supported-dps="24x24" fill="currentColor">
<path d="M14 12a2 2 0 11-2-2 2 2 0 012 2zM4 10a2 2 0 102 2 2 2 0 00-2-2zm16 0a2 2 0 102 2 2 2 0 00-2-2z"></path>
</svg>
</div>
</li>
<li class="notification">
<img class="notification__avatar" src="https://assets.codepen.io/240751/foto-sushi-6anudmpILw4-unsplash.png" alt="" />
<div class="notification__body">
Wish <b>that guy who made you cry in the bathroom</b> a happy birthday.
</div>
<div class="notification__interactive">
<div class="notification__time">4w</div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1.5rem" id="overflow-web-ios-medium" aria-hidden="true" role="none" data-supported-dps="24x24" fill="currentColor">
<path d="M14 12a2 2 0 11-2-2 2 2 0 012 2zM4 10a2 2 0 102 2 2 2 0 00-2-2zm16 0a2 2 0 102 2 2 2 0 00-2-2z"></path>
</svg>
</div>
<div></div>
<button class="notification__button">
Say happy birthday
</button>
</li>
</ul>
</main>
<footer>
Images courtesy <a href="https://unsplash.com">Unsplash</a>
</footer>
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: -apple-system, system-ui, BlinkMacSystemFont, Segoe UI, Roboto,
Helvetica Neue, Fira Sans, Ubuntu, Oxygen, Oxygen Sans, Cantarell,
Droid Sans, Apple Color Emoji, Segoe UI Emoji, Segoe UI Emoji,
Segoe UI Symbol, Lucida Grande, Helvetica, Arial, sans-serif;
color: #191919;
line-height: 1.25;
min-height: 100dvh;
background-color: #f4f2ee;
}
main {
padding: 1rem;
}
.card {
border-radius: 0.8rem;
background-color: white;
border: 1px solid #dfdeda;
list-style-type: none;
max-width: 35rem;
margin-inline: auto;
padding: 0 0 1rem;
}
.notification {
display: grid;
grid-template-columns: auto 1fr auto;
align-items: center;
gap: 0 14px;
padding: 1rem 1rem 1rem 1.5rem;
font-size: 0.875rem;
line-height: 1.425;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transition: background-color 0.3s ease;
}
.notification:hover {
background-color: #ebebeb;
}
.notification__interactive {
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.notification__time {
color: #666666;
text-align: right;
}
.notification__avatar {
width: 3rem;
height: 3rem;
border-radius: 3rem;
}
header {
height: 53px;
border-bottom: 1px solid #dfdeda;
background: white;
display: flex;
align-items: stretch;
padding: 8px;
}
.header__search {
background: #edf3f8;
width: 100%;
height: 100%;
border-radius: 5px;
}
.wrapper {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
height: 100%;
width: 100%;
max-width: 35rem;
margin: 0 auto;
}
.header__content {
display: flex;
align-items: center;
gap: 8px;
height: 100%;
width: 100%;
}
header svg {
width: 37px;
height: auto;
}
.header__buttons {
gap: 8px;
color: #666666;
height: 24px;
justify-content: end;
}
.header__buttons svg {
max-height: 100%;
}
.header__icon {
width: auto;
height: 100%;
aspect-ratio: 1 / 1;
background: #666666;
border-radius: 24px;
margin-left: 10px;
}
.blur {
filter: blur(3px);
overflow: hidden;
}
.square {
border-radius: 0;
}
.notification__button {
background: transparent;
color: #0a66c2;
border: 1px solid currentColor;
font: inherit;
font-weight: bold;
border-radius: 100px;
padding: 5px 10px;
display: inline-block;
font-size: 1rem;
margin-top: 0;
width: max-content;
}
.shared-post {
border: 1px solid #e8e8e8;
padding: 8px;
border-radius: 8px;
margin-top: 4px;
background-color: white;
}
.social-counts {
font-size: 0.75rem;
color: #666666;
margin-top: 4px;
}
footer {
font-size: 0.5rem;
text-align: center;
padding: 1em;
}
Also see: Tab Triggers