I have a very simple problem. I wanted to make a lists of cards from left to right. My problem is that the card is on the center right now and when i add another card it adds up below. I wanted it to be like from left to right.
Pls see this codesandbox link
const useStyles = makeStyles(theme => ({
root: {
display: "flex",
justifyContent: "initial"
},
title: {
marginBottom: "30px"
},
header: {
marginBottom: "20px",
display: "flex",
alignItems: "center",
justifyContent: "space-between"
},
card: {
maxWidth: 300,
margin: "auto",
transition: "0.3s",
boxShadow: "0 8px 40px -12px rgba(0,0,0,0.3)",
"&:hover": {
boxShadow: "0 16px 70px -12.125px rgba(0,0,0,0.3)"
}
},
media: {
paddingTop: "56.25%"
},
content: {
textAlign: "left",
padding: theme.spacing.unit * 3
},
divider: {
margin: `${theme.spacing.unit * 3}px 0`
},
heading: {
fontWeight: "bold"
},
subheading: {
lineHeight: 1.8
},
avatar: {
display: "inline-block",
border: "2px solid white",
"&:not(:first-of-type)": {
marginLeft: theme.spacing.unit
}
}
}));
Material UI has a pretty sweet grid implementation via the Grid component. Just wrap your cards in a <Grid container>
like so:
<Grid container>
<Card className={classes.card}>
...
</Card>
</Grid>