如何向上移動「內容」和「右」區塊?問題是我不能使用子嵌套網格。我不需要黑客:無邊距,因爲標題可以是不同的高度。沒有JavaScript。只有純CSS。如果可能的話。不同高度的CSS網格單元
現在我的標記看起來像這樣:
.wrapper {
border: 1px solid red;
display: grid;
grid-template-columns: 1fr 2fr 1fr;
grid-template-areas:
"aside header header"
"left content right";
grid-gap: 15px;
}
.header, .aside, .left, .content, .right {
border: 1px solid black;
padding: 10px;
}
.header {
grid-area: header;
height: 30px; /* in real case it's responsive height */
}
.aside {
grid-area: aside;
height: 80px; /* in real case it's responsive height */
}
.left {
grid-area: left;
}
.content {
grid-area: content;
background: yellow;
}
.right {
grid-area: right;
background: yellow;
}
.left, .content, .right {
height: 100px; /* in real case it's responsive height */
}
<div class="wrapper">
<!-- this order should be on mobile -->
<header class="header">header</header>
<aside class="aside">aside</aside>
<div class="left">left</div>
<div class="content">content</div>
<div class="right">right</div>
</div>
你能創建2個獨立的網格嗎?一個用於上排,另一個用於下排 – user3808887