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">
<h2>Scrolling Card UI With CSS Grid</h2>
<ul class="cards">
<li class="card">
<div>
<h3 class="card-title">Service 1</h3>
<div class="card-content">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
</div>
</div>
<div class="card-link-wrapper">
<a href="" class="card-link">Learn More</a>
</div>
</li>
<li class="card">
<div>
<h3 class="card-title">Service 2</h3>
<div class="card-content">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ab repudiandae magnam harum natus fuga et repellat in maiores.</p>
</div>
</div>
<div class="card-link-wrapper">
<a href="" class="card-link">Learn More</a>
</div>
</li>
<li class="card">
<div>
<h3 class="card-title">Service 3</h3>
<div class="card-content">
<p>Phasellus ultrices lorem vel bibendum ultricies. In hendrerit nulla a ante dapibus pulvinar eu eget quam.</p>
</div>
</div>
<div class="card-link-wrapper">
<a href="" class="card-link">Learn More</a>
</div>
</li>
<li class="card">
<div>
<h3 class="card-title">Service 4</h3>
<div class="card-content">
<p>Aenean posuere mauris quam, pellentesque auctor mi bibendum nec. Sed scelerisque lacus nisi, quis auctor lorem ornare vel.</p>
</div>
</div>
<div class="card-link-wrapper">
<a href="" class="card-link">Learn More</a>
</div>
</li>
<li class="card">
<div>
<h3 class="card-title">Service 5</h3>
<div class="card-content">
<p>Vestibulum pharetra fringilla felis sit amet tempor. Interdum et malesuada fames ac ante ipsum primis in faucibus. Cras et arcu sit amet est consequat feugiat. Nam ut sapien pulvinar.</p>
</div>
</div>
<div class="card-link-wrapper">
<a href="" class="card-link">Learn More</a>
</div>
</li>
<li class="card">
<div>
<h3 class="card-title">Service 6</h3>
<div class="card-content">
<p>Donec ut tincidunt nisl. Vivamus eget eros id elit feugiat mollis. Nam sed sem quis libero finibus tempor.</p>
</div>
</div>
<div class="card-link-wrapper">
<a href="" class="card-link">Learn More</a>
</div>
</li>
<li class="card">
<div>
<h3 class="card-title">Service 7</h3>
<div class="card-content">
<p>Aliquam eget nisl auctor, sollicitudin ipsum at, dignissim ligula. Donec tincidunt in elit et pellentesque. Integer posuere metus ac massa mollis euismod.</p>
</div>
</div>
<div class="card-link-wrapper">
<a href="" class="card-link">Learn More</a>
</div>
</li>
<li class="card">
<div>
<h3 class="card-title">Service 8</h3>
<div class="card-content">
<p> Vivamus eget eros id elit feugiat mollis. Nam sed sem quis libero finibus tempor.</p>
</div>
</div>
<div class="card-link-wrapper">
<a href="" class="card-link">Learn More</a>
</div>
</li>
<li class="card">
<div>
<h3 class="card-title">Service 9</h3>
<div class="card-content">
<p>Duis id congue turpis. Donec sodales porta felis, nec ultricies ante. Nam placerat vitae metus sit amet tempor. Aliquam ac dictum est.</p>
</div>
</div>
<div class="card-link-wrapper">
<a href="" class="card-link">Learn More</a>
</div>
</li>
<li class="card">
<div>
<h3 class="card-title">Service 10</h3>
<div class="card-content">
<p>Pellentesque eget eros eget justo efficitur fermentum.</p>
</div>
</div>
<div class="card-link-wrapper">
<a href="" class="card-link">Learn More</a>
</div>
</li>
<li class="card">
<div>
<h3 class="card-title">Service 11</h3>
<div class="card-content">
<p>Phasellus posuere nec nibh ut tincidunt. Aenean mollis turpis non eros posuere, at luctus leo hendrerit. Integer non libero sapien.</p>
</div>
</div>
<div class="card-link-wrapper">
<a href="" class="card-link">Learn More</a>
</div>
</li>
<li class="card">
<div>
<h3 class="card-title">Service 12</h3>
<div class="card-content">
<p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Vestibulum ornare metus ac lectus scelerisque volutpat.</p>
</div>
</div>
<div class="card-link-wrapper">
<a href="" class="card-link">Learn More</a>
</div>
</li>
</ul>
</div>
<footer class="page-footer">
<span>made by </span>
<a href="https://georgemartsoukos.com/" target="_blank">
<img width="24" height="24" src="https://assets.codepen.io/162656/george-martsoukos-small-logo.svg" alt="George Martsoukos logo">
</a>
</footer>
:root {
--orange: #fd9940;
--darkorange: #dd7d25;
--platinum: #e5e5e5;
--black: #2b2d42;
--white: #fff;
--thumb: #edf2f4;
}
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
body {
font: 16px / 24px "Rubik", sans-serif;
color: var(--black);
background: var(--platinum);
margin: 50px 0;
}
.container {
max-width: 1400px;
padding: 0 15px;
margin: 0 auto;
}
h2 {
font-size: 32px;
margin-bottom: 1em;
}
.cards {
display: grid;
grid-auto-columns: 100%;
grid-column-gap: 10px;
grid-auto-flow: column;
padding: 25px 0px;
list-style: none;
overflow-x: scroll;
scroll-snap-type: x mandatory;
}
.card {
display: flex;
flex-direction: column;
padding: 20px;
background: var(--white);
border-radius: 12px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 15%);
scroll-snap-align: start;
transition: all 0.2s;
}
.card:hover {
color: var(--white);
background: var(--orange);
}
.card .card-title {
font-size: 20px;
}
.card .card-content {
margin: 20px 0;
max-width: 85%;
}
.card .card-link-wrapper {
margin-top: auto;
}
.card .card-link {
display: inline-block;
text-decoration: none;
color: white;
background: var(--orange);
padding: 6px 12px;
border-radius: 8px;
transition: background 0.2s;
}
.card:hover .card-link {
background: var(--darkorange);
}
.cards::-webkit-scrollbar {
height: 12px;
}
.cards::-webkit-scrollbar-thumb,
.cards::-webkit-scrollbar-track {
border-radius: 92px;
}
.cards::-webkit-scrollbar-thumb {
background: var(--darkorange);
}
.cards::-webkit-scrollbar-track {
background: var(--thumb);
}
@media (min-width: 500px) {
.cards {
grid-auto-columns: calc(50% - 10px);
grid-column-gap: 20px;
}
}
@media (min-width: 700px) {
.cards {
grid-auto-columns: calc(calc(100% / 3) - 20px);
grid-column-gap: 30px;
}
}
@media (min-width: 1100px) {
.cards {
grid-auto-columns: calc(25% - 30px);
grid-column-gap: 40px;
}
}
/* FOOTER STYLES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.page-footer {
position: fixed;
right: 0;
bottom: 50px;
display: flex;
align-items: center;
padding: 5px;
z-index: 1;
}
.page-footer a {
display: flex;
margin-left: 4px;
}
Also see: Tab Triggers