问题
I have a problem overriding the styles in my theme in Material UI in React.
I wanted to customize the border
of columnsContainer
but it isn't working. only the root
is working well.
Check Here for Codesanbox
MuiDataGrid.js
export default {
root: {
backgroundColor: "white",
border: `1px solid green`,
"& .columnsContainer": {
borderBottom: `1px solid 'blue' !important`
}
}
};
回答1:
Below is the correct syntax. The changes compared to your code sandbox are:
- Replace
.columnsContainer
with.MuiDataGrid-columnsContainer
- Correct the borderBottom syntax to be
1px solid blue
instead of1px solid 'blue' !important
.
export default {
root: {
backgroundColor: "white",
border: `1px solid green`,
"& .MuiDataGrid-columnsContainer": {
borderBottom: `1px solid blue`
}
}
};
来源:https://stackoverflow.com/questions/64726379/overriding-styles-in-material-ui-in-react