Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource


Add Packages

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.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="card">
  <div class="card__img-wrapper">
    <div class="card__img" role="img" alt="Fresh herbs">🌿</div>
  <div class="card__content-wrapper">
    <p class="card__meta">Cooking</p>
    <div class="card__header">
      <h1 class="card__title">Fresh herbs</h1>
      <svg class="card__heart" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
        <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"></path>
    <p class="card__description">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Est tempora facere voluptatum suscipit mollitia nulla unde aliquid animi molestias laboriosam?</p>
    <div class="card__footer">
      <button class="card__btn card__btn--outline">Add to cart</button>
      <button class="card__btn">Buy now</button>


                * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;

:root {
  --gray-100: hsl(152, 45%, 10%);
  --gray-200: hsl(152, 25%, 25%);
  --gray-300: hsl(152, 10%, 40%);
  --gray-400: hsl(152, 10%, 83%);
  --gray-500: hsl(152, 10%, 96%);

  --green-100: hsl(152, 100%, 8%);
  --green-200: hsl(152, 100%, 16%);
  --green-300: hsl(152, 100%, 25%);
  --green-400: hsl(152, 50%, 50%);
  --green-500: hsl(152, 50%, 96%);

  --maroon-100: hsl(332, 100%, 8%);
  --maroon-200: hsl(332, 100%, 16%);
  --maroon-300: hsl(332, 100%, 25%);
  --maroon-400: hsl(332, 50%, 50%);
  --maroon-500: hsl(332, 50%, 96%);

  --white: hsl(0, 0%, 100%);

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1;

.card {
  max-width: 26rem;
  min-width: 16rem;
  border-radius: 1rem;
  overflow: hidden;
  background: var(--white);
  box-shadow: 0px 2px 4px 0px rgb(0 0 0 / 8%);

.card__img-wrapper {
  display: grid;
  place-items: center;
  margin-bottom: 2rem;
  padding: 2rem;
  background: var(--green-500);

.card__content-wrapper {
  padding: 0 2rem 2rem;

.card__img {
  width: 50%;
  max-width: 6rem;
  /* card image is shown once twemoji has parsed */
  display: none;

.card__meta {
  position: relative;
  display: inline-block;
  margin-bottom: 0.75rem;
  padding-right: 0.75rem;
  font-size: 0.75rem;
  line-height: 0.75rem;
  color: var(--gray-300);

.card__meta:before {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  content: "";
  width: 0.25rem;
  height: 0.25rem;
  background: var(--green-400);
  border-radius: 50%;

.card__header {
  display: flex;
  margin-bottom: 1.75rem;

.card__title {
  font-size: 1.5rem;
  line-height: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--gray-100);

.card__heart {
  width: 1rem;
  height: 1rem;
  margin-top: 0.25rem;
  margin-left: auto;
  color: var(--maroon-300);
  fill: var(--maroon-500);

.card__description {
  margin-bottom: 2.25rem;
  font-size: 0.875rem;
  line-height: 1.5rem;
  hyphens: auto;
  -webkit-hyphens: auto;
  color: var(--gray-200);

.card__footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 1rem;

.card__btn {
  width: 100%;
  height: 2.5rem;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 500;
  background: var(--green-300);
  color: var(--green-500);
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;

.card__btn--outline {
  background: var(--white);
  color: var(--gray-200);
  border: 1px solid var(--gray-400);

@media only screen and (max-width: 480px) {
  body {
    padding: 1rem;

  .card__content-wrapper {
    padding: 0 1.5rem 1.5rem;

  .card__footer {
    grid-gap: 0.75rem;



                const productImage = document.querySelector(".card__img");

// replace the emoji with an svg version that will scale to larger sizes
twemoji.parse(productImage, {
  folder: "svg",
  ext: ".svg",
  callback: function (icon, options, variant) { = "block";

    return "".concat(options.base, options.size, "/", icon, options.ext);