- I am new to responsive material design.
- when I move to smaller screens, Sports Status should stay in the right corner.
- and 4Standard, 5Standard, 6Standard, 7Standard, 8Standard, 9Standard should come to next line.
i googled and found the below line for media queries and tested color is changing, but not sure how to change the layout
["@media (min-width:780px)"]: { // eslint-disable-line no-useless-computed-key backgroundColor: "red" }
is it possible to change the structure of my layout using css alone or I need to put condition in js
- can you tell me how to fix it. providing sandbox and code snippet below
small screen: https://codesandbox.io/s/material-demo-xkwyl
big screen: https://xkwyl.codesandbox.io/
sportsCardHeaderItem: {
color: "black",
margin: "10",
textAlign: "left",
paddingLeft: 16,
backgroundColor: "green",
["@media (min-width:780px)"]: {
// eslint-disable-line no-useless-computed-key
backgroundColor: "red"
}
},
sportsCardHeaderItemSecond: {
margin: "10",
textAlign: "left",
paddingLeft: 24
},
sportsCardHeaderItemHeading: {
fontSize: 14,
color: "#455A64"
},
sportsCardHeaderItemHeadingValue: {
fontWeight: "bold",
fontSize: 20,
color: "#263238"
},
Below is the markup
<div
style={{ flexGrow: "0" }}
className={classes.sportsCardHeaderItemSecond}
>
<div className={classes.sportsCardHeaderItemHeading}>3Standard</div>
<div className={classes.sportsCardHeaderItemHeadingValue}>jkjkjk</div>
</div>
<div
style={{ flexGrow: "0" }}
className={classes.sportsCardHeaderItemSecond}
>
<div className={classes.sportsCardHeaderItemHeading}>4Standard</div>
<div className={classes.sportsCardHeaderItemHeadingValue}>jkjkjk</div>
</div>
<div
style={{ flexGrow: "0" }}
className={classes.sportsCardHeaderItemSecond}
>
<div className={classes.sportsCardHeaderItemHeading}>5Standard</div>
<div className={classes.sportsCardHeaderItemHeadingValue}>jkjkjk</div>
</div>
<div
style={{ flexGrow: "0" }}
className={classes.sportsCardHeaderItemSecond}
>
<div className={classes.sportsCardHeaderItemHeading}>6Standard</div>
<div className={classes.sportsCardHeaderItemHeadingValue}>jkjkjk</div>
</div>
You can follow the general principle detailed in "Adaptive page layout with Media Queries" from Mathieu Nebra and Emily Reese.
For example:
If you have the right structure CSS code, you can apply a similar rule.