Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ 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

Auto Save

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

              
                <aside>
  <h1>Logo</h1>
  <nav>
    <a href="">CSS</a>
    <a href="">HTML</a>
    <a href="">JavaScript</a>
    <a href="">React</a>
    <a href="">Vue</a>
  </nav>
</aside>
<main>
  <div class="section">
    <div class="section__heading">
      <h3 class="section__title">爆款直降</h3>
    </div>
    <div class="section__body">
      <ul class="cards">
        <li class="card">
          <div class="card__media">
            <img src="https://picsum.photos/222/?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>
        </li>
        <li class="card">
          <div class="card__media">
            <img src="https://picsum.photos/222/?random=23" 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>
        </li>
        <li class="card">
          <div class="card__media">
            <img src="https://picsum.photos/222/?random=32" 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>
        </li>
        <li class="card">
          <div class="card__media">
            <img src="https://picsum.photos/222/?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>
        </li>
        <li class="card">
          <div class="card__media">
            <img src="https://picsum.photos/222/?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>
        </li>
        <li class="card">
          <div class="card__media">
            <img src="https://picsum.photos/222/?random=3" 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>
        </li>
        <li class="card">
          <div class="card__media">
            <img src="https://picsum.photos/222/?random=43" 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>
        </li>
        <li class="card">
          <div class="card__media">
            <img src="https://picsum.photos/222/?random=35" 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>
        </li>
        <li class="card">
          <div class="card__media">
            <img src="https://picsum.photos/222/?random=36" 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>
        </li>
        <li class="card">
          <div class="card__media">
            <img src="https://picsum.photos/222/?random=63" 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>
        </li>
        <li class="card">
          <div class="card__media">
            <img src="https://picsum.photos/222/?random=38" 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>
        </li>
      </ul>
    </div>
  </div>
</main>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");

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

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

  background-color: #557;
  width: 100vw;
  min-height: 100vh;
  font-family: "Exo", Arial, sans-serif;
  line-height: 1.5;
  background-color: #557;
}

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

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

ul {
  list-style: none outside none;
}

main,
aside {
  background-color: #f4f4f4;
}

.section {
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow: hidden;
  resize: horizontal;
}

.section__heading {
  display: flex;
  align-items: center;
  color: #333;
  margin-bottom: 24px;
}

.section__title {
  font-size: 32px;
  font-weight: 500;
}

.cards {
  --gap: 18px;
  --minwidth: 220px;

  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(min(100%, var(--minwidth)), 1fr)
  );
  gap: var(--gap);
}

.card {
  background-color: #fff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
}

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

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

aside {
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

aside h1 {
  margin: 0;
}

nav {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
}

nav a {
  display: block;
  padding: 10px 0;
  text-decoration: none;
  font-size: clamp(1rem, 1.25rem + 2vw, 1.5rem);
}

body {
  display: grid;
  gap: 1rem;
  grid-template-areas:
    "sidebar"
    "main";
}

@media (min-width: 768px) {
  body {
    grid-template-columns: fit-content(250px) 1fr;
    grid-template-areas: "sidebar main";
  }
}

aside {
  grid-area: sidebar;
}

main {
  grid-area: main;
}

              
            
!

JS

              
                
              
            
!
999px

Console