[英]How to put background color on mui useStyle?
I dont know what i am missing on this, or whats wrong on this code, but the background color is not reflecting, please help, thanks我不知道我错过了什么,或者这个代码有什么问题,但是背景颜色没有反映,请帮忙,谢谢
import { makeStyles } from '@mui/styles';
const useStyles = makeStyles((theme) => ({
root: {
height: '-webkit-fill-available',
margin: 0,
paddingLeft: 30,
background: 'rgba(239, 243, 246, 1)' //it doesnt work why?
},
}));
const Homepage = () => {
const classes = useStyles();
return (
<div className={classes.root} id="style">
<h4>About this School</h4>
<About />
</div>
);
};
Add comma at the end of background code.在后台代码末尾添加逗号。
root: {
height: '-webkit-fill-available',
margin: 0,
paddingLeft: 30,
background: 'rgba(239, 243, 246, 1)',
},
as @Prathamesh Koshti said it's working well in the latest version.正如@Prathamesh Koshti 所说,它在最新版本中运行良好。 just inspect the element and check whether the background color was overriding or not.只需检查元素并检查背景颜色是否覆盖。 working code here 工作代码在这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.