CSS 网格列

标签 css css-grid

我有这个代码:

.four-items-across-container{
    display:grid;
    grid-template-columns:0px 80% 1fr; 
}

我想知道当我调整页面宽度为 800px 时,例如 1fr 列可以在没有媒体查询的情况下获得另一行吗?

如果是,怎么办?

最佳答案

我觉得flexbox更适合这个

.container {
  display: flex;
  height:100px;
  flex-wrap:wrap;
  width:100%;
}
.container > div:first-child{
  flex:1 1 80%;
  background:red;
}
.container > div:last-child{
  flex:1 1 20%;
  background:blue;
  min-width:100px; /*adjust this like you want*/
}

/*to illustrate*/
.container:hover {
  width:40%;
  transition:1s all;
}
<div class="container">
  <div></div>
  <div></div>
</div>

关于CSS 网格列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52991229/

相关文章:

css - 使按钮适合所有浏览器

css - 我可以在不对每个行元素应用样式的情况下隐藏网格行吗?

html - 按数字顺序排列的 CSS 网格布局

html - CSS 网格 : Pushing a div to the first column and making it span 100% on hover

Android webview 4.4 css 100% 不显示任何内容

jquery - 如何删除选择框的所有边框?

css - JSF/PrimeFaces 标签如何解析为默认 CSS 样式?

html - 需要设计水平表

html - 这可以用 CSS Grid 实现吗?

html - 无法实现特定的 CSS 网格布局