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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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__media">
    <img src="https://picsum.photos/640/?random=11" alt="">
    <div class="card__badge">年货节</div>
  </div>
  <div class="card__content">
    <div class="card__heading">
      <h4 class="card__title">卡片标题卡片标题</h4>
    </div>
    <div class="card__des">口味清爽,最多八个字</div>
    <div class="card__action">
      <div class="card__price">
        <span>&yen;</span>
        <strong>32</strong>
      </div>
      <div class="card__link">
        <svg t="1639970508640" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9201" width="200" height="200">
          <path d="M398.933333 326.4l168.533334 168.533333-168.533334 168.533334c-14.933333 14.933333-14.933333 38.4 0 53.333333s38.4 14.933333 53.333334 0l196.266666-196.266667c14.933333-14.933333 14.933333-38.4 0-53.333333l-196.266666-196.266667c-14.933333-14.933333-38.4-14.933333-53.333334 0s-14.933333 40.533333 0 55.466667zM512 981.333333C251.733333 981.333333 42.666667 772.266667 42.666667 512S251.733333 42.666667 512 42.666667s469.333333 209.066667 469.333333 469.333333-209.066667 469.333333-469.333333 469.333333z" p-id="9202" fill="currentColor"></path>
        </svg>
      </div>
    </div>
  </div>
</div>

<div class="card">
  <div class="card__media">
    <img src="https://picsum.photos/640/?random=1" alt="">
    <div class="card__badge">年货节</div>
  </div>
  <div class="card__content">
    <div class="card__heading">
      <h4 class="card__title">卡片标题卡片标题</h4>
    </div>
    <div class="card__des">口味清爽,最多八个字</div>
    <div class="card__action">
      <div class="card__price">
        <span>&yen;</span>
        <strong>32</strong>
      </div>
      <div class="card__link">
        <svg t="1639970508640" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9201" width="200" height="200">
          <path d="M398.933333 326.4l168.533334 168.533333-168.533334 168.533334c-14.933333 14.933333-14.933333 38.4 0 53.333333s38.4 14.933333 53.333334 0l196.266666-196.266667c14.933333-14.933333 14.933333-38.4 0-53.333333l-196.266666-196.266667c-14.933333-14.933333-38.4-14.933333-53.333334 0s-14.933333 40.533333 0 55.466667zM512 981.333333C251.733333 981.333333 42.666667 772.266667 42.666667 512S251.733333 42.666667 512 42.666667s469.333333 209.066667 469.333333 469.333333-209.066667 469.333333-469.333333 469.333333z" p-id="9202" fill="currentColor"></path>
        </svg>
      </div>
    </div>
  </div>
</div>

<div class="card">
  <div class="card__media">
    <img src="https://picsum.photos/640/?random=2" alt="">
    <div class="card__badge">年货节</div>
  </div>
  <div class="card__content">
    <div class="card__heading">
      <h4 class="card__title">卡片标题卡片标题</h4>
    </div>
    <div class="card__des">口味清爽,最多八个字</div>
    <div class="card__action">
      <div class="card__price">
        <span>&yen;</span>
        <strong>32</strong>
      </div>
      <div class="card__link">
        <svg t="1639970508640" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9201" width="200" height="200">
          <path d="M398.933333 326.4l168.533334 168.533333-168.533334 168.533334c-14.933333 14.933333-14.933333 38.4 0 53.333333s38.4 14.933333 53.333334 0l196.266666-196.266667c14.933333-14.933333 14.933333-38.4 0-53.333333l-196.266666-196.266667c-14.933333-14.933333-38.4-14.933333-53.333334 0s-14.933333 40.533333 0 55.466667zM512 981.333333C251.733333 981.333333 42.666667 772.266667 42.666667 512S251.733333 42.666667 512 42.666667s469.333333 209.066667 469.333333 469.333333-209.066667 469.333333-469.333333 469.333333z" p-id="9202" fill="currentColor"></path>
        </svg>
      </div>
    </div>
  </div>
</div>

<div class="card">
  <div class="card__media">
    <img src="https://picsum.photos/640/?random=12" alt="">
    <div class="card__badge">年货节</div>
  </div>
  <div class="card__content">
    <div class="card__heading">
      <h4 class="card__title">卡片标题卡片标题</h4>
    </div>
    <div class="card__des">口味清爽,最多八个字</div>
    <div class="card__action">
      <div class="card__price">
        <span>&yen;</span>
        <strong>32</strong>
      </div>
      <div class="card__link">
        <svg t="1639970508640" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9201" width="200" height="200">
          <path d="M398.933333 326.4l168.533334 168.533333-168.533334 168.533334c-14.933333 14.933333-14.933333 38.4 0 53.333333s38.4 14.933333 53.333334 0l196.266666-196.266667c14.933333-14.933333 14.933333-38.4 0-53.333333l-196.266666-196.266667c-14.933333-14.933333-38.4-14.933333-53.333334 0s-14.933333 40.533333 0 55.466667zM512 981.333333C251.733333 981.333333 42.666667 772.266667 42.666667 512S251.733333 42.666667 512 42.666667s469.333333 209.066667 469.333333 469.333333-209.066667 469.333333-469.333333 469.333333z" p-id="9202" fill="currentColor"></path>
        </svg>
      </div>
    </div>
  </div>
</div>

<div class="card">
  <div class="card__media">
    <img src="https://picsum.photos/640/?random=21" alt="">
    <div class="card__badge">年货节</div>
  </div>
  <div class="card__content">
    <div class="card__heading">
      <h4 class="card__title">卡片标题卡片标题</h4>
    </div>
    <div class="card__des">口味清爽,最多八个字</div>
    <div class="card__action">
      <div class="card__price">
        <span>&yen;</span>
        <strong>32</strong>
      </div>
      <div class="card__link">
        <svg t="1639970508640" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9201" width="200" height="200">
          <path d="M398.933333 326.4l168.533334 168.533333-168.533334 168.533334c-14.933333 14.933333-14.933333 38.4 0 53.333333s38.4 14.933333 53.333334 0l196.266666-196.266667c14.933333-14.933333 14.933333-38.4 0-53.333333l-196.266666-196.266667c-14.933333-14.933333-38.4-14.933333-53.333334 0s-14.933333 40.533333 0 55.466667zM512 981.333333C251.733333 981.333333 42.666667 772.266667 42.666667 512S251.733333 42.666667 512 42.666667s469.333333 209.066667 469.333333 469.333333-209.066667 469.333333-469.333333 469.333333z" p-id="9202" fill="currentColor"></path>
        </svg>
      </div>
    </div>
  </div>
</div>

<div class="card">
  <div class="card__media">
    <img src="https://picsum.photos/640/?random=16" alt="">
    <div class="card__badge">年货节</div>
  </div>
  <div class="card__content">
    <div class="card__heading">
      <h4 class="card__title">卡片标题卡片标题</h4>
    </div>
    <div class="card__des">口味清爽,最多八个字</div>
    <div class="card__action">
      <div class="card__price">
        <span>&yen;</span>
        <strong>32</strong>
      </div>
      <div class="card__link">
        <svg t="1639970508640" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9201" width="200" height="200">
          <path d="M398.933333 326.4l168.533334 168.533333-168.533334 168.533334c-14.933333 14.933333-14.933333 38.4 0 53.333333s38.4 14.933333 53.333334 0l196.266666-196.266667c14.933333-14.933333 14.933333-38.4 0-53.333333l-196.266666-196.266667c-14.933333-14.933333-38.4-14.933333-53.333334 0s-14.933333 40.533333 0 55.466667zM512 981.333333C251.733333 981.333333 42.666667 772.266667 42.666667 512S251.733333 42.666667 512 42.666667s469.333333 209.066667 469.333333 469.333333-209.066667 469.333333-469.333333 469.333333z" p-id="9202" fill="currentColor"></path>
        </svg>
      </div>
    </div>
  </div>
</div>

<div class="card">
  <div class="card__media">
    <img src="https://picsum.photos/640/?random=15" alt="">
    <div class="card__badge">年货节</div>
  </div>
  <div class="card__content">
    <div class="card__heading">
      <h4 class="card__title">卡片标题卡片标题</h4>
    </div>
    <div class="card__des">口味清爽,最多八个字</div>
    <div class="card__action">
      <div class="card__price">
        <span>&yen;</span>
        <strong>32</strong>
      </div>
      <div class="card__link">
        <svg t="1639970508640" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9201" width="200" height="200">
          <path d="M398.933333 326.4l168.533334 168.533333-168.533334 168.533334c-14.933333 14.933333-14.933333 38.4 0 53.333333s38.4 14.933333 53.333334 0l196.266666-196.266667c14.933333-14.933333 14.933333-38.4 0-53.333333l-196.266666-196.266667c-14.933333-14.933333-38.4-14.933333-53.333334 0s-14.933333 40.533333 0 55.466667zM512 981.333333C251.733333 981.333333 42.666667 772.266667 42.666667 512S251.733333 42.666667 512 42.666667s469.333333 209.066667 469.333333 469.333333-209.066667 469.333333-469.333333 469.333333z" p-id="9202" fill="currentColor"></path>
        </svg>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

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

body {
  width: 100vw;
  min-height: 100vh;

  background-color: #557;

  display: grid;

  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 20px;
  padding: 0;
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: top;
}

svg {
  width: 1em;
  height: 1em;
}

.card {
  background-color: #fff;
  display: flex;
  flex-direction: column;
  min-width: 320px;
}

.card__media {
  position: relative;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  padding: 14px;
}

.card__media img {
  aspect-ratio: 16 / 9;
}

.card__media .card__badge {
  position: absolute;
  background-image: linear-gradient(90deg, #ff5000 0%, #ff0552 99%);
  border-radius: 4px;
  color: #fff;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 2px 4px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  left: 14px;
  bottom: -12px;
}

.card__content {
  display: flex;
  flex-direction: column;
  padding: 0 14px 24px;
}

.card__title {
  font-weight: 500;
  font-size: 24px;
  color: #333333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.card__des {
  max-width: 8em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 20px;
  color: #ba9663;
  margin-bottom: 18px;
}

.card__action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  font-size: 32px;
  color: #ff5000;
  line-height: 1;
}

.card__price {
  display: inline-flex;
  align-items: flex-end;
}

.card__price span {
  font-weight: normal;
  font-size: 24px;
  position: relative;
  bottom: 0.125em;
}

.card__link {
  font-size: 32px;
  font-weight: normal;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.card,
.card__media {
  border-radius: 0;
}

@media (min-width: 768px) {
  body {
    padding: 20px;
  }
  .card {
    border-radius: 24px;
  }
  .card__media img {
    border-radius: 10px 10px 0 0;
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console