【发布时间】:2018-08-10 09:16:07
【问题描述】:
我有一个非常相似的问题to this one。
我已经从https://material-ui.com/demos/cards/ 分叉了 Material UI Card 示例。链接to the sandbox editor is here。
基本上我需要将 Material UI 卡片水平堆叠在父 div 内的一行中,当它们不适合时,它们会在前一行下方创建另一行。
所以当我写的时候:
render(
<div className="row">
<Demo /> <Demo />
</div>,
rootElement
);
我希望将两张卡放在一起。
我用display: "inline-block"添加了以下样式,但卡片仍然垂直堆叠:
const styles = {
card: {
minWidth: 275,
display: "inline-block"
}
};
【问题讨论】:
-
因为您应该在作为卡片codesandbox.io/s/82xn3oppr8 的父级的
div元素上使用该自定义样式,但也许更好的解决方案是使用Grid组件。
标签: css reactjs material-ui