我Grid在 ReactJs 中使用 MUI 结构来显示 5 列,如下所示:
在较小的屏幕中,列会移动到下一行。但在较小的屏幕中,我还希望所有列仅显示在一行中,并且我可以通过水平滚动来访问其他列。
<Grid
container
spacing={2}
style={{
maxHeight: "100vh",
overflowY: "auto",
overflowX: "hidden",
height: "440px",
overflow: "auto",
}}
>
<Grid item xs={2.1}>
{cards.map((card) => <Card props={card} /> )}
</Grid>
</Grid>
Run Code Online (Sandbox Code Playgroud)