在材料用户界面中,当我尝试在Box中放置元素时,为什么“ spacing”样式属性不起作用?

问题描述 投票:0回答:1

我在React 16.10应用程序中使用materialUI。我的盒子里有两个按钮。

        <Box
          style={{
            marginTop: "3rem",
            marginLeft: "1rem",
            display: "flex",
            justifyContent: "center",
    spacing: 1,
          }}
        >
          <Button onClick={handleSave} variant="contained" color="primary">
            SAVE
          </Button>

          <Button
            onClick={toDetailsView}
            startIcon={<CancelIcon />}
            variant="contained"
            color="primary"
          >
          CANCEL
          </Button>
        </Box>

即使我使用的是“ spacing:1”,这些按钮也紧挨着出现,因此无法区分一个结束位置和下一个开始位置...

enter image description here

如何添加样式,以便在按钮之间留一点空间?

css reactjs material-ui spacing box
1个回答
0
投票

正在寻找简单的解决方法?保证金:1雷姆;

© www.soinside.com 2019 - 2024. All rights reserved.