Implementing a table scrolling carousel effect through CSS animation

Implementing a table scrolling carousel effect through CSS animation

An application of CSS animation, with the same content as the previous CSS revolving lantern. It’s just a different application, and the specific implementation is as follows

sheet

<template>
  <section>
    <div class="box">
      <ul class="header">
        <li class="cell">Serial number</li>
        <li class="cell">Name</li>
        <li class="cell">Age</li>
        <li class="cell">Gender</li>
        <li class="cell">Professional</li>
      </ul>
      <div class="body">
        <ul class="list">
          <li
            v-for="(item, index) in arr"
            :key="index"
            class="row"
          >
            <span class="cell">{{ item }}</span>
            <span v-for="(n) in 4" :key="n*30" class="cell">{{ n }}</span>
          </li>
        </ul>
      </div>
    </div>
  </section>
</template>

<script>
export default {
  data() {
    return {
      arr: [],
    }
  },
  created() {
    this.arr = Array.from(new Array(20), (v, k) => {
      return k + 1
    })
    // The table displays 5 rows of data. Here we copy the first 5 rows of data to achieve seamlessness this.arr = this.arr.concat(this.arr.slice(0, 5))
  }
}
</script>

<style lang="scss">
$cellHeight: 30px;
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.box {
  width: 60%;
  margin: auto;
}
.header {
  display: flex;
}
.body {
  height: 5 * $cellHeight;
  overflow: hidden;
  // padding-bottom: 10px;
  li {
    display: flex;
    height: $cellHeight;
  }
}
.cell {
  flex: 1;
  height: $cellHeight;
  line-height: $cellHeight;
  border: 1px solid #e2e2e2;
  box-sizing: border-box;
}
.list {
  animation: scroll 10s linear infinite;
  position: relative;
}

@keyframes scroll {
  from { top: 0; }
  to { top: -20 * $cellHeight }
}
</style>

Summarize

This is the end of this article about how to achieve a table scrolling carousel effect through CSS animation. For more relevant CSS animation table scrolling carousel content, please search 123WORDPRESS.COM’s previous articles or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

<<:  Nginx request limit configuration method

>>:  What is the function and writing order of the a tag pseudo class

Recommend

Getting Started Tutorial for Beginners: Domain Name Resolution and Binding

So after registering a domain name and purchasing...

Example of using supervisor to manage nginx+tomcat containers

need: Use docker to start nginx + tomcat dual pro...

Analyze MySQL replication and tuning principles and methods

1. Introduction MySQL comes with a replication so...

Implementation of nginx proxy port 80 to port 443

The nginx.conf configuration file is as follows u...

Vue implements an example of pulling down and scrolling to load data

Table of contents Step 1: Installation Step 2: Ci...

MySQL advanced learning index advantages and disadvantages and rules of use

1. Advantages and Disadvantages of Indexes Advant...

How to deal with garbled characters in Mysql database

In MySQL, database garbled characters can general...

Example of how to import nginx logs into elasticsearch

The nginx logs are collected by filebeat and pass...

Web componentd component internal event callback and pain point analysis

Table of contents Written in front What exactly i...

Centos7 startup process and Nginx startup configuration in Systemd

Centos7 startup process: 1.post(Power-On-Self-Tes...

html option disable select select disable option example

Copy code The code is as follows: <select> ...

WeChat Mini Program Lottery Number Generator

This article shares the specific code of the WeCh...

A brief analysis of the usage of HTML float

Some usage of float Left suspension: float:left; ...

How to modify the "Browse" button of the html form to upload files

Copy code The code is as follows: <!DOCTYPE HT...

IE6 distortion problem

question: <input type="hidden" name=...