【发布时间】:2019-03-08 11:09:14
【问题描述】:
我在 React JS 项目中使用 Grid 组件时遇到了一点问题,我将从编写一些代码开始,然后解释我想要使用图像实现的目标:
假设这是渲染的代码:
<div style="margin:100px 20%; width:80%" >
<Grid container>
<Grid item xs={6}>
<MyElement
contentLeft="Something displayed in the left"
contentRight="Something displayed in the right"
>
</Grid>
<Grid item xs={6}>
<MyElement
contentLeft="Something displayed in the left"
contentRight="Something displayed in the right"
>
</Grid>
</Grid>
</div>
下面是它的外观(红色的我的网格和黑色的大 div):
当我调整窗口大小并使其变小时,它的外观是这样的:
我知道我的正确元素有问题,这很容易,因为我制作了它的 CSS,但我现在不知道如何控制 Grids 属性,因为我希望 xs 在某个位置从 6 变为 12。
怎么做?如果不可能,有更好的解决方案吗?
任何帮助将不胜感激。
【问题讨论】:
标签: css reactjs responsive-design material-ui