【问题标题】:Material UI gap prop is ignored by box-sizing: border-box, Is there a way to force it to not ignore the gap?材质 UI 间隙道具被 box-sizing:border-box 忽略,有没有办法强制它不忽略间隙?
【发布时间】:2021-09-21 23:50:22
【问题描述】:

我正在使用 Material UI,我有一个简单的 Grid 组件,其中嵌套了三个 Grid,如下所示:

父容器是一个带有这些属性的 Grid:

  <Grid  container component="form" noValidate autoComplete="on" gap={2}>

问题在于,通过将 gap={2} 添加到父级按钮会被按下,尽管它具有 box-sizing:border-box;

这是 Material UI 提供的默认 css:

似乎 box-sizing 忽略了差距。 我可以使用 flex-wrap: nowrap 强制执行此操作,但应该有一种方法可以让 box-sizing 不会忽略间隙,对吧?

【问题讨论】:

    标签: reactjs material-ui


    【解决方案1】:

    您是否尝试将输入和按钮封装在 spandiv 或其他东西中?

    我记得的一点是,磨削系统的输入和内容并不总是按预期工作。

    【讨论】:

      猜你喜欢
      • 2012-02-10
      • 2014-06-30
      • 2014-12-01
      • 2013-04-19
      • 1970-01-01
      • 2020-07-02
      • 1970-01-01
      • 2010-11-17
      • 2015-06-01
      相关资源
      最近更新 更多