<div class="g-container">
  <ul style="--s: 6">
    <li>
      <img src="https://static.apdnews.com/image/20161228/1482898199741754.jpg">
    </li>
    <li>
      <img src="https://i.pinimg.com/originals/e8/ba/25/e8ba252917952f23dfc9715e942e654e.jpg">
    </li>
    <li>
      <img src="https://www.womenly.net/wp-content/uploads/2017/03/Tips-to-Maintain-the-Soft-Skin.jpg">
    </li>
    <li>
      <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTD8kEsEE3hJ64aU-_TKQJtvKDtTOGQfT3A4A&usqp=CAU">
    </li>
    <li>
      <img src="https://c4.wallpaperflare.com/wallpaper/290/224/929/women-face-choker-portrait-wallpaper-preview.jpg">
    </li>
    <li>
      <img src="http://mywordsnthoughts.com/myworld/wp-content/uploads/2018/01/beautiful-neck.jpg">
    </li>
    <!--末尾补一个首尾数据-->
    <li>
      <img src="https://static.apdnews.com/image/20161228/1482898199741754.jpg">
    </li>
  </ul>
</div>
*{
  padding:0;margin:0;
}
li{
  list-style:none;
}

body, html {
  width: 100%;
  height: 100%;
  display: flex;
}

:root {
  --w: 400;
  --speed: 1.5s;
}

.g-container {
  width: 400px;
  margin: auto;
  height: 240px;
  line-height: 240px;
  font-size: 20px;
  background: #673ab7;
  color: #fff;
  overflow: hidden;
  border: 2px solid #000;
}

ul {
  display: flex;
  flex-wrap: nowrap;
}

ul li {
  flex-shrink: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

ul li img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

ul {
  animation: move calc(var(--speed) * var(--s)) steps(var(--s)) infinite;
}

ul li {
  white-space: nowrap;
  cursor: pointer;
  animation: move1 calc(var(--speed)) infinite;
}

@keyframes move {
  0% {
    transform: translate(0, 0px);
  }
  100% {
    transform: translate(calc(var(--s) * var(--w) * -1px), 0);
  }
}

@keyframes move1 {
  0% {
    transform: translate(0, 0px);
  }
  80%,
  100%  {
    transform: translate(calc(var(--w) * -1px), 0);
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.