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

              
                    <section class="cat">
      <div class="cat__head">
        <h2 class="cat__title">Slider</h2>
        <div class="cat__button">
          <a href="/" class="cat__link">もっと見る</a>
        </div>
      </div>
      <div class="cat__body">
        <div class="swiper-container cat-slider">
          <div class="swiper-wrapper">
            <div class="swiper-slide">
              <div class="swiper-item">
                <a href="#" class="swiper-item__link">
                  <div class="swiper-item__box">
                    <img src="https://drive.google.com/uc?export=view&id=1fArpMEHBZKZLICTuIicQU0o8slHdwZMe" alt="image-cat" class="swiper-item__img" />
                  </div>
                  <p class="swiper-item__title">あけましておめでとうございます♪</p>
                  <div class="swiper-item__text">
                    <span class="swiper-item__text-name">つむぎちゃん</span>
                    <span class="swiper-item__text-date">2022/01/01</span>
                  </div>
                </a>
              </div>
            </div>
            <div class="swiper-slide">
              <div class="swiper-item">
                <a href="#" class="swiper-item__link">
                  <div class="swiper-item__box">
                    <img src="https://drive.google.com/uc?export=view&id=1WUVJM-1kAddhTI0kLRYOhMYQu3vvHTcJ" alt="image-cat" class="swiper-item__img" />
                  </div>
                  <p class="swiper-item__title">あけましておめでとうございます♪</p>
                  <div class="swiper-item__text">
                    <span class="swiper-item__text-name">こはくちゃん</span>
                    <span class="swiper-item__text-date">2022/01/01</span>
                  </div>
                </a>
              </div>
            </div>
            <div class="swiper-slide">
              <div class="swiper-item">
                <a href="#" class="swiper-item__link">
                  <div class="swiper-item__box">
                    <img src="https://drive.google.com/uc?export=view&id=1NXG4p-TdNqH_93ZQpQ5-W2SeEVKgSMop" alt="image-cat" class="swiper-item__img" />
                  </div>
                  <p class="swiper-item__title">あけましておめでとうございます♪</p>
                  <div class="swiper-item__text">
                    <span class="swiper-item__text-name">こゆきさん</span>
                    <span class="swiper-item__text-date">2022/01/01</span>
                  </div>
                </a>
              </div>
            </div>
            <div class="swiper-slide">
              <div class="swiper-item">
                <a href="#" class="swiper-item__link">
                  <div class="swiper-item__box">
                    <img src="https://drive.google.com/uc?export=view&id=1Kslzk35Pcx_FlLtLv2nejIi3cGj0pE4Z" alt="image-cat" class="swiper-item__img" />
                  </div>
                  <p class="swiper-item__title">あけましておめでとうございます♪</p>
                  <div class="swiper-item__text">
                    <span class="swiper-item__text-name">つむぎちゃん&こゆきさん</span>
                    <span class="swiper-item__text-date">2022/01/01</span>
                  </div>
                </a>
              </div>
            </div>
            <div class="swiper-slide">
              <div class="swiper-item">
                <a href="#" class="swiper-item__link">
                  <div class="swiper-item__box">
                    <img src="https://drive.google.com/uc?export=view&id=1fArpMEHBZKZLICTuIicQU0o8slHdwZMe" alt="image-cat" class="swiper-item__img" />
                  </div>
                  <p class="swiper-item__title">あけましておめでとうございます♪</p>
                  <div class="swiper-item__text">
                    <span class="swiper-item__text-name">つむぎちゃん</span>
                    <span class="swiper-item__text-date">2022/01/01</span>
                  </div>
                </a>
              </div>
            </div>
            <div class="swiper-slide">
              <div class="swiper-item">
                <a href="#" class="swiper-item__link">
                  <div class="swiper-item__box">
                    <img src="https://drive.google.com/uc?export=view&id=1WUVJM-1kAddhTI0kLRYOhMYQu3vvHTcJ" alt="image-cat" class="swiper-item__img" />
                  </div>
                  <p class="swiper-item__title">あけましておめでとうございます♪</p>
                  <div class="swiper-item__text">
                    <span class="swiper-item__text-name">こはくちゃん</span>
                    <span class="swiper-item__text-date">2022/01/01</span>
                  </div>
                </a>
              </div>
            </div>
            <div class="swiper-slide">
              <div class="swiper-item">
                <a href="#" class="swiper-item__link">
                  <div class="swiper-item__box">
                    <img src="https://drive.google.com/uc?export=view&id=1NXG4p-TdNqH_93ZQpQ5-W2SeEVKgSMop" alt="image-cat" class="swiper-item__img" />
                  </div>
                  <p class="swiper-item__title">あけましておめでとうございます♪</p>
                  <div class="swiper-item__text">
                    <span class="swiper-item__text-name">こゆきさん</span>
                    <span class="swiper-item__text-date">2022/01/01</span>
                  </div>
                </a>
              </div>
            </div>
          </div>
        </div>
        <div class="swiper-button-prev swiper-button-prev--cat"></div>
        <div class="swiper-button-next swiper-button-next--cat"></div>
      </div>
    </section>
              
            
!

CSS

              
                a {
  text-decoration: none;
  color: #1f2832;
}

p {
  margin: 0;
}

.cat {
  display: flex;
  align-items: center;
@media screen and (max-width:767px) { 
    display: block;
}
  }

  .cat__head {
    width: 35%;
    padding: 3% 6% 0;
    @media screen and (max-width:767px) {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      padding: 0;
    }
  }
  .cat__title {
    font-size: 2.4rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    @media screen and (max-width:767px) {
      margin-right: 15px;
    }
  }
  .cat__button {
    margin: 56px 0 0;
    @media screen and (max-width:767px) {
      width: 50%;
      margin: 0;
    }
  }
  .cat__link {
    display: block;
    width: 90%;
    padding: 20px 0;
    margin: 0 auto;
    text-align: center;
    border: solid 1px #ddd;
    border-radius: 20px;
  }
  .cat__body {
    position: relative;
    width: 70%;
    margin: 80px 0;
    @media screen and (max-width:767px) {
      width: 100%;
    }

    &::after {
      position: absolute;
      top: 50%;
      right: 0;
      width: calc(100% + 20px);
      height: calc(100% + 40px);
      content: "";
      background: #f1f4fa;
      border-radius: 20px 0 0 20px;
      transform: translate(0, -50%);
    }
}
    .swiper-slide {
      position: relative;
      width: 370px;
      margin-right: 20px;
      transition: 0.3s;
      &:first-child {
        margin-left: 20px;
      }
      &.slide_off {
        opacity: 0;
      }
      .swiper-item {
        margin: 20px 0;
        overflow: hidden;
        border-radius: 20px;
        box-shadow: 0 5px 16px 0 rgb(0 0 0 / 8%);

        .swiper-item__link {
          position: relative;
          z-index: 1;
          display: block;
          height: 100%;
          padding-bottom: 24px;
          overflow: hidden;
          background: #fff;
          .swiper-item__img {
            width: 100%;
            height: 250px;
            margin-bottom: 15px;
            overflow: hidden;
            border-radius: 20px 20px 0 0;
            object-fit: cover;
            @media screen and (max-width:767px) {
              height: 190px;
            }
          }
          .swiper-item__title {
            padding: 0 24px;
            margin-bottom: 1em;
            font-weight: bold;
            line-height: 1.3;
          }
          .swiper-item__text {
            display: flex;
            justify-content: space-between;
            padding: 0 24px;
            overflow: hidden;
            font-size: 0.8rem;
            color: #aaa;
          }
        }
      }
    }
    .swiper-button-next--cat,
    .swiper-button-prev--cat {
      width: 50px;
      height: 50px;
      margin: 0;
      background-size: 50px 50px;
      transform: translate(0, -50%);
      &::after {
        display: none;
      }
      @media screen and (max-width:767px) {
        display: none;
      }
    }
    .swiper-button-next--cat {
      right: 30px;
      left: auto;
      background-color: rgba(255, 255, 255, 0.85);
      background-image: url("https://icooon-mono.com/i/icon_12253/icon_122531_64.png");
      background-size: 28px;
      border-radius: 50px;
    }
    .swiper-button-prev--cat {
      right: calc(100% - 5px);
      left: auto;
      z-index: 30;
      background-color: rgba(255, 255, 255, 0.85);
      background-image: url("https://icooon-mono.com/i/icon_12252/icon_122521_64.png");
      background-size: 28px;
      border-radius: 50px;
    }
              
            
!

JS

              
                const mySwiper = new Swiper(".cat-slider", {
  spaceBetween: 50,
  width: 370,
  breakpoints: {
    767: {
      spaceBetween: 15,
      width: 290,
      slidesPerView: 1
    }
  },
  navigation: {
    nextEl: ".swiper-button-next--cat",
    prevEl: ".swiper-button-prev--cat"
  }
});
              
            
!
999px

Console