- 我是响应式材料设计的新手。
- 当我移动到较小的屏幕时,Sports Status 应该保持在右角。
- 和 4Standard, 5Standard, 6Standard, 7Standard, 8Standard, 9Standard 应该到下一行。
我用谷歌搜索并发现媒体查询和测试颜色正在改变的以下行,但不确定如何更改布局
["@media (min-width:780px)"]: { // eslint-disable-line no-useless-computed-key backgroundColor: "red" }
是否可以单独使用 css 更改布局的结构,或者我需要在 js 中放置条件
- 你能告诉我怎么修吗?在下面提供沙箱和代码片段
小屏:https : //codesandbox.io/s/material-demo-xkwyl
大屏: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"
},
下面是标记
<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>