模态不能减小小屏幕上的尺寸

发布于 2025-01-22 14:14:43 字数 746 浏览 0 评论 0原文

使用Create-React-app fyi。我有这个模态软件包,我从 https://www.npmjs.com/package/反应反应模式。它指出它是响应迅速的。

我正确地实现了它,并导入了“反应反应模式/样式”;确保它反应灵敏。但是,当在移动设备上时,我的内容被切断了,模式不会最小化,我正在使用CSS网格。我不是正确打电话吗?我希望实现的是,随着屏幕越来越小,模态的尺寸不断减小。

网格CSS

      .container {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(250px, auto));
      grid-gap: 5rem;
      margin-top: 2rem;
      justify-items: center;
      align-items: center;
}
.item {
  object-fit: cover;
  width: 100%;
  max-height: 100%;
  border-radius: 25px;
  cursor: pointer;
}
<Modal>
 <img scr="/myimage.png" />
</Modal>

Using create-react-app fyi. I have this modal package I used from https://www.npmjs.com/package/react-responsive-modal. It states that it is responsive.

I implemented it correctly and imported "react-responsive-modal/styles.css"; to make sure it is responsive. But when on mobile my content gets cut off and the modal doesn't minimize, I'm using CSS grid. Am I not calling something correctly? What I'm hoping to achieve is the modal keeps reducing in size as screens get smaller.

Grid CSS

      .container {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(250px, auto));
      grid-gap: 5rem;
      margin-top: 2rem;
      justify-items: center;
      align-items: center;
}
.item {
  object-fit: cover;
  width: 100%;
  max-height: 100%;
  border-radius: 25px;
  cursor: pointer;
}
<Modal>
 <img scr="/myimage.png" />
</Modal>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文