css 如何在表格中适应Flex或网格分页,而不会在不适合时推动表格的单元格?

rmbxnbpk  于 11个月前  发布在  其他
关注(0)|答案(1)|浏览(108)

我想在表格中适应这个分页,但是当我在flex中使用flex-direction:row显示页面按钮时,它会推动表格的单元格,而它的工作方式就像我在表格之外所希望的那样。
这将是更容易理解这些截图:x1c 0d1x看起来好在这里,但我想按钮是内联。
这就是我想要的,但是它会把表格中的单元格推进去。
如果需要的话,我不介意使用flex或grid或额外的div Package 器,但它必须是响应式的,没有固定的宽度/最大宽度和跨现代浏览器。
我在Chrome上测试。
这里是Codepen:https://codepen.io/antoniandre/pen/RwdaPmY?editors=0100的链接,以及HTML / SCSS的片段。

<div class="block" id="app">
  <div class="w-table__pagination w-pagination mb12">
    <div wrap="true" class="w-select w-select--filled w-select--no-padding w-select--inner-icon-right w-pagination__items-per-page"><label class="w-select__label w-select__label--left w-form-el-shakable inherit">Items per page</label>
      <div class="w-select__selection-wrap primary w-select__selection-wrap--underline w-select__selection-wrap--no-padding" role="button" aria-haspopup="listbox" aria-expanded="false" aria-owns="w-select-menu--11" aria-activedescendant="w-select-menu--11_item-1">
        <div class="w-select__selection" readonly="" ariareadonly="true" contenteditable="true">50</div><input type="hidden" name="w-select--11" value="50">
        <!----><label class="w-icon wi-triangle-down w-select__icon w-select__icon--inner-right" role="icon" aria-hidden="true">
          <!---->
        </label>
      </div>
    </div>
    <div class="pages-wrap"><button class="w-button primary w-button--text w-button--icon size--lg w-pagination__arrow w-pagination__arrow--prev" type="button" disabled=""><i class="w-icon wi-chevron-left" role="icon" aria-hidden="true">
        </i>
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page w-pagination__page--active" type="button">1
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">2
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">3
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">4
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">5
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">6
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">7
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">8
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">9
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">10
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">11
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">12
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">13
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">14
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">15
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">16
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">17
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">18
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">19
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">20
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">21
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">22
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">23
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">24
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">25
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">26
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">27
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">28
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">29
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">30
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">31
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">32
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">33
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">34
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">35
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">36
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">37
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">38
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">39
        <!---->
      </button><button class="w-button primary--bg w-button--round size--lg w-pagination__page" type="button">40
        <!---->
      </button><button class="w-button primary w-button--text w-button--icon size--lg w-pagination__arrow w-pagination__arrow--next" type="button"><i class="w-icon wi-chevron-right" role="icon" aria-hidden="true">
          <!---->
        </i>
        <!---->
      </button></div><span class="w-pagination__results">1-50 of 2000</span>
  </div>
  <w-table :headers="table.headers" :items="table.items" fixed-headers="fixed-headers" fixed-footer="fixed-footer" :fetch="table.fetch" :pagination="table.pagination" :loading="table.loading" style="max-height: 500px"></w-table>
</div>

个字符
即使以后样式/UI可能会改变,这个基本布局仍然很重要,所以它不会推动单元格。

lokaqttq

lokaqttq1#

你需要告诉你的flexbox它可以 Package 它的内容。这在默认情况下是关闭的。

.w-table__pagination .pages-wrap {
  display: flex;
  flex-wrap: wrap;
}

字符串

相关问题