关于#css#的问题,如何解决?

css使用表格如果使得无数据的图片在表格内上下左右都居中

img


<template>
  <div class="container">
    <table>
      <thead>
        <tr>
          <th>序号th>
          <th>标题1th>
          <th>标题2th>
          <th>标题3th>
          <th v-for="i in 30">
            {{ i + i + i }}qqq
          th>
        tr>
      thead>
      <tbody>
        { d + d + d }}
          
         -->
       
      tbody>
      <tfoot>
        <td colspan="34">
          <a-empty />
        td>
      tfoot>
    table>
  div>

template>
<script>
import { defineComponent, ref, reactive } from 'vue';

export default defineComponent({
  setup() {

    return {

    };
  },
});
script>
<style scoped lang="scss">
.container {
  width: 98%;
  height: calc(100vh - 20px);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  overflow: scroll;
}

table {
  table-layout: fixed;
  border: none;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  text-align: center;

  thead {
    tr {
      color: white;
      height: 70px;

      th {
        background-color: #CCE8EB;
        min-width: 100px;
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        z-index: 3;
        border: 1px solid #fff;
        border-top: 1px solid #fff;
        /*--新增--*/
        border-bottom: 1px solid #fff;
        /*--新增--*/
        border-right: 1px solid #fff;
        /*--新增--*/
      }

      th:nth-of-type(1) {
        background-color: #269191;
        left: 0;
        z-index: 4;
      }

      th:nth-of-type(2) {
        background-color: #269191;
        left: 100px;
        z-index: 4;
      }

      th:nth-of-type(3) {
        background-color: #269191;
        left: 200px;
        z-index: 4;
      }

      th:nth-of-type(4) {
        background-color: #269191;
        left: 300px;
        z-index: 4;
      }
    }
  }

  tbody {
    tr {
      height: 50px;
      color: green;

      td {
        border-bottom: 1px solid #f00;
        /*--新增--*/
        border-right: 1px solid #f00;
        /*--新增--*/
        min-width: 100px;
        position: -webkit-sticky;
        position: sticky;
        border: 1px solid red;
      }

      td:nth-of-type(1) {
        background-color: #CCE8EB;
        font-weight: bold;
        left: 0;
        z-index: 3;
      }

      td:nth-of-type(2) {
        background-color: #CCE8EB;
        left: 100px;
        z-index: 3;
      }

      td:nth-of-type(3) {
        background-color: #CCE8EB;
        left: 200px;
        z-index: 3;
      }

      td:nth-of-type(4) {
        background-color: #CCE8EB;
        box-shadow: 5px 5px 5px #0078A855;
        left: 300px;
        z-index: 3;
      }
    }
  }

}
style>

可以考虑absolute或者fixed定位

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632