![](/img/trans.png)
[英]How to disable OverlayScrollbars when window width equal 600px?
[英]How to disable MUI Grid items from stacking when window width is smaller than 600px
我正在使用 MUI Grid
組件進行布局。 我將兩個網格項目並排放置,一個放置在其下方。 但是,當我調整窗口大小並且寬度變得小於600px
,彼此相鄰的兩個網格項將堆疊。 有人知道我在哪里可以禁用600px
窗口寬度下堆疊的兩個網格項目嗎?
您可以在 此處查看默認斷點值以了解xs
或sm
是什么。 在Grid
item 中, xs={12} sm={6}
表示當屏幕小於sm
( 600px
) 時,grid item 跨越 12 列(100% 寬度),當它小於md
且大於xs
,grid item跨越 6 列(50% 寬度)
<Grid container spacing={2}>
<Grid item xs={12} sm={6}>
<Item>xs=12 sm=6</Item>
</Grid>
<Grid item xs={12} sm={6}>
<Item>xs=12 sm=6</Item>
</Grid>
<Grid item xs={12}>
<Item>xs=12</Item>
</Grid>
</Grid>
編輯:當寬度小於600px
時禁用堆疊:
<Grid container spacing={2}>
<Grid item xs={6}>
<Item>xs=6</Item>
</Grid>
<Grid item xs={6}>
<Item>xs=6</Item>
</Grid>
<Grid item xs={12}>
<Item>xs=12</Item>
</Grid>
</Grid>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.