代码之家  ›  专栏  ›  技术社区  ›  Edgar Navasardyan

有一个无限滚动的表,占据了页面的剩余空间

  •  0
  • Edgar Navasardyan  · 技术社区  · 4 年前

    我有几个关于组织CSS的问题。我正在使用Semantic UI库来增强我的标记,但目前我一直在努力让我的表占据页面的其余部分,在主页上没有滚动,只有表部分是可滚动的。有可能吗?

    滚动应从表体开始!

    https://jsfiddle.net/nedgar8/azdbnhfq/1/

    <body>
      <div class="ui fixed inverted menu">
        <a class="item" href="/">Main</a>
      </div>
      <div class="ui container">
          <table class="ui striped celled selectable table">
            <thead>
              <tr>
                <td>
                  My header
                </td>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td class="">My row 1 </td>
              </tr>
              <tr>
                <td class="">My row </td>
              </tr>
              <tr>
                <td class="">My row </td>
              </tr>
              <tr>
                <td class="">My row </td>
              </tr>
              <tr>
                <td class="">My row </td>
              </tr>
              <tr>
                <td class="">My row </td>
              </tr>
              <tr>
                <td class="">My row </td>
              </tr>
              <tr>
                <td class="">My row </td>
              </tr>
              <tr>
                <td class="">My row </td>
              </tr>
              <tr>
                <td class="">My row </td>
              </tr>
              <tr>
                <td class="">My row </td>
              </tr>
              <tr>
                <td class="">My row </td>
              </tr>
              <tr>
                <td class="">My row </td>
              </tr>
            </tbody>
          </table>
          <div> My Footer </div>
      </div>
    </body>
    
    0 回复  |  直到 4 年前
        1
  •  0
  •   mhhabib    4 年前

    使用 overflow-x: scroll 在里面 ui-container 我在这里设定了一个高度 300px .之后 300px 它将垂直滚动。

    <body>
      <div class="ui fixed inverted menu">
        <a class="item" href="/">Main</a>
      </div>
      <div class="ui-container" style="height:300px;overflow-x: scroll;">
          <table class="ui striped celled selectable table">
           ................
          </table>
      </div>
      <div> My Footer </div>
    </body>
    

    我使用了一些CSS ui容器 将页眉和页脚分开。

    body {
        padding: 1em;
    }
    .ui-container{
      margin-top:50px;
      margin-bottom:30px;
    }