【问题标题】:How i can have my table responsive on mobile?我怎样才能让我的桌子在移动设备上响应?
【发布时间】:2021-01-20 22:13:02
【问题描述】:

我正在尝试使我的表格具有响应性,但我有一个 Marge。我把表格设置为响应式,但即使这样它也不起作用。

我在另一个页面上做了同样的事情,它可以工作。不适合这个,奇怪!

<Container className='dataContainer' fluid>
      <Row>
        <Col>
        <h3>Base de données client</h3>
        </Col>
        </Row>
        <Row >
        <Table class="table-responsive" striped hover>
        <thead>
      <tr>
        <th>Nom</th>
        <th>Prenom</th>
        <th>Mail</th>
        <th>Numero</th>
        <th>Age</th>
      </tr>
      </thead>
      <tbody>
        {this.display()}
        </tbody>
        </Table>
     </Row>
       
      
</Container>

【问题讨论】:

    标签: javascript css reactjs


    【解决方案1】:

    你在使用 Bootstrap 吗?如果是这样,您需要一个带有 class="table-responsive" 的表格标签周围的 div。

    像这样:

    <div class="table-responsive">
    <table class="table">
    </table>
    </div>
    

    Css 看起来像这样:

    .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    }
    .table{
    width: 100%;
    }
    

    【讨论】:

    • @WendyMontagnon 为什么“fluid”、“striped”和“hover”不在类标签内?也许这就是问题所在?
    猜你喜欢
    • 2018-11-09
    • 1970-01-01
    • 2021-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-07
    • 2021-02-26
    相关资源
    最近更新 更多