网格箱的最小像素

发布于 2025-01-22 07:09:12 字数 192 浏览 1 评论 0原文

在此处输入图像描述我有一个带有2个网格箱,3fr和1,5fr的网格箱。现在,我想制作一个具有“ Gridbox 2(1,5FR)小于100px的CSS,请转到下一行。我不知道这是否可能。

enter image description hereI have a gridbox with 2 gridboxes, 3fr and 1,5fr. Now I would like to make a CSS that has something like "if gridbox 2 (1,5fr) is smaller than 100px, go to the next row. I don't know if this is possible.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别在捏我脸啦 2025-01-29 07:09:12

我认为Flexbox对于您想要做的事情可能会更容易,但是如果您想使用网格,则必须使用@Media。

.container{
    display: grid;
    grid-template-columns: minmax(200px,3fr) minmax(100px, 1.5fr);
}

@media screen and (max-width:330px) {
    .container{
      grid-template-columns: 1fr;
    }
}

您可能必须根据您的特定代码调整数字,但这将使“容器”类中的元素在低于阈值时占用100%。

I think flexbox might be easier for what you're looking to do, but if you want to use a grid you will have to use @media.

.container{
    display: grid;
    grid-template-columns: minmax(200px,3fr) minmax(100px, 1.5fr);
}

@media screen and (max-width:330px) {
    .container{
      grid-template-columns: 1fr;
    }
}

You may have to adjust the numbers depending on your particular code, but this will make the elements inside the "container" class take up 100% when below the threshold.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文