如何将css网格中的pixel转换为fr?

发布于 2025-01-11 18:37:37 字数 130 浏览 2 评论 0原文

我有一个总宽度为 1000px 的 div 容器,我决定使用 CSS 网格分隔 5 列。 网格模板列:100px 100px 100px 600px 100px; 如何将此像素转换为 fr ? 网格模板列:?fr ?fr ?fr ?fr ?fr;

I have a div container with a total width of 1000px and I decided to separate 5 columns using a CSS grid.
grid template columns : 100px 100px 100px 600px 100px;
how to convert this pixel to fr ?
grid template columns : ?fr ?fr ?fr ?fr ?fr;

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

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

发布评论

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

评论(2

我要还你自由 2025-01-18 18:37:37

您可以使用 1fr 1fr 1fr 600px 1fr 这将使第 4 个减少 600px,其余部分将根据剩余空间进行调整

You can use 1fr 1fr 1fr 600px 1fr which will make 4th one off 600px and rest will adjust according to remaining space

爱要勇敢去追 2025-01-18 18:37:37

您能详细说明一下吗?您还没有指定您想要或不想要的间隙。
现在你能做什么

  grid-template-columns: 1fr 1fr 1fr 6fr 1fr;

另外,假设如果你想要列之间有 10px 的间隙,那么可以通过以下方式实现相同的效果:

grid-template-columns: 1fr 1fr 1fr 6fr 1fr;
grid-column-gap: 10px;

Can you please elaborate more on this? You haven't specified gap you want or not.
what can you do for now

  grid-template-columns: 1fr 1fr 1fr 6fr 1fr;

Also, let's say if you want a gap of 10px between the columns, then the same could be acheived by:

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