Pen Settings

HTML

CSS

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <div class="card">
  <div class="card__img-wrapper">
    <div class="card__img" role="img">❓</div>
  </div>
  <div class="card__content-wrapper">
    <p class="card__meta">Meta</p>
    <div class="card__header">
      <h1 class="card__title">Product title</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>
      </svg>
    </div>
    <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>
    </div>
  </div>
</div>
              
            
!

CSS

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

:root {
  --black: hsl(0, 0%, 0%);
  --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;
  background: var(--white);
  color: var(--black);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0px 2px 4px 0px rgb(0 0 0 / 8%);
}

.card__img-wrapper {
  display: grid;
  place-items: center;
  margin-bottom: 2rem;
  padding: 2rem;
}

.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;
}

.card__meta:before {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  content: "";
  width: 0.25rem;
  height: 0.25rem;
  background: var(--black);
  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;
}

.card__heart {
  width: 1rem;
  height: 1rem;
  margin-top: 0.25rem;
  margin-left: auto;
}

.card__description {
  margin-bottom: 2.25rem;
  font-size: 0.875rem;
  line-height: 1.5rem;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.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(--black);
  color: var(--white);
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
}

.card__btn--outline {
  background: var(--white);
  color: var(--black);
  border: 1px solid var(--black);
}

@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;
  }
}

              
            
!

JS

              
                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) {
    productImage.style.display = "block";

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

              
            
!
999px

Console