javascript - 在网格中垂直堆叠控件?

标签 javascript reactjs material-ui

我得到了以下 Paper 元素,其中包含一些复选框:

enter image description here

我希望它们垂直堆叠,但我不太清楚如何。我的 Paper 元素位于网格项中:

<Grid item xs={1} spacing={4}>
    <Paper className={classes.paper}>
        <Typography>(currently empty)</Typography>
        {this.getBoxesWithLabels(this.getLevelLabels(4, -3))}
    </Paper>
</Grid>

因此它在用户界面上不会有太多空间(这是预期的)。我该怎么办呢?我尝试过使用 justifyContent、justifySelf、alignItems 等,但它没有改变任何内容。

最佳答案

试试这个:

<Grid item xs={1} spacing={4}>
    <Paper className={classes.paper}>
        <Grid direction="column">
            <Typography>(currently empty)</Typography>
            {this.getBoxesWithLabels(this.getLevelLabels(4, -3))}
        </Grid>
    </Paper>
</Grid>

关于javascript - 在网格中垂直堆叠控件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54073633/

相关文章:

javascript - CSS 预加载在 Google Chrome 之外不起作用

reactjs - 如何在 Typescript 2.8 中使用 Flux Container.create

reactjs - 基于海拔的 Material UI 纸背景颜色?

javascript - Material-UI RefreshIndicator 在初始页面加载中不显示

javascript - 当没有找到测试时,Mocha 会抛出一个错误。这能被压制吗?

javascript - 在 iMacros 中重新加载页面后,如何定位名称每次都在变化的表单输入字段?

javascript - JQuery animate() 函数延迟运行缓慢

javascript - 如何在 react 中获得返回的 div 的偏移量/位置?

javascript - React-Redux:映射对象数组并从每个对象初始化一个组件

reactjs - 使用 Material-ui 列表在抽屉中渲染组件