*初级小白*~ 2022-11-21 15:10 采纳率: 97.9%
浏览 3
已结题

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

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

img


<template>
  <div class="container">
    <table>
      <thead>
        <tr>
          <th>序号</th>
          <th>标题1</th>
          <th>标题2</th>
          <th>标题3</th>
          <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>

  • 写回答

3条回答 默认 最新

  • CSDN专家-showbo 2022-11-21 15:19
    关注

    可以考虑absolute或者fixed定位

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 11月30日
  • 已采纳回答 11月22日
  • 创建了问题 11月21日

悬赏问题

  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab