admin管理员组文章数量:1221352
Would like to be able to set portrait and landscape views on the styles object for tablets in Material UI
const styles = theme => ({
root: {
padding: theme.spacing.unit,
[theme.breakpoints.up('md')]: {
backgroundColor: theme.palette.secondary.main
}
}
}
how can i add breakpoints for portrait view and landscape view similar to the traditional media query:
@media screen and (orientation: landscape) {
body {
flex-direction: row;
}
}
@media screen and (orientation: portrait) {
body {
flex-direction: column;
}
}
Would like to be able to set portrait and landscape views on the styles object for tablets in Material UI
const styles = theme => ({
root: {
padding: theme.spacing.unit,
[theme.breakpoints.up('md')]: {
backgroundColor: theme.palette.secondary.main
}
}
}
how can i add breakpoints for portrait view and landscape view similar to the traditional media query:
@media screen and (orientation: landscape) {
body {
flex-direction: row;
}
}
@media screen and (orientation: portrait) {
body {
flex-direction: column;
}
}
Share
Improve this question
edited Sep 6, 2018 at 17:54
Julio Cornelio
asked Sep 3, 2018 at 13:08
Julio CornelioJulio Cornelio
1711 gold badge2 silver badges6 bronze badges
1
- 1 what issue you're facing ? – Sakhi Mansoor Commented Sep 3, 2018 at 13:09
3 Answers
Reset to default 10Just set something like that:
const styles = theme => ({
root: {
padding: theme.spacing.unit,
[`${theme.breakpoints.up('md')} and (orientation: portrait)`]: {
flexDirection: 'column'
}
}
}
You're able to use something like this:
'@media (orientation: landscape)': {
flexDirection: `orientation`,
},
for the component media query will be attached.
Used this in version 4.11.1
const useStyles = makeStyle((theme) =>({
container:{
border:"1px dashed red",
[theme.breakpoints.down("md")]{
border: "1px solid blue",
'@media (orientation: landscape)': {
border: "1px solid green",,
},
},
},
}));
本文标签: javascriptMaterial UI breakpoints to set orientation portrait and landscape viewStack Overflow
版权声明:本文标题:javascript - Material UI breakpoints to set orientation: portrait and landscape view - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739361336a2159833.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论