如何在React和Material UI中访问更改组件内部项目的样式? [英] How can I access to change styles of inner items of a component in react and material ui?
本文介绍了如何在React和Material UI中访问更改组件内部项目的样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何访问组件子级的内部CSS类,并为其添加样式或更改样式?就像我想更改和自定义ui ui步进材质的步骤,圆圈的字体大小和颜色等等.
How can I access to inner css classes of children of a component and add or change styles to/of them? like I want to change and customize material ui stepper steps circle font size and color and so on.
我如何编写像下面这样的css类:
How can I write css classes like bellow:
.stepper circle {
font-size:18px;
}
或
.stepper .text {
font-size:18px;
}
谢谢.
推荐答案
感谢@spakmad的回答,但这不完全是我的意思,也许我的问题还不够清楚.我的意思是如何以实质性的ui对象样式类格式(用withStyle HOC注入的类)编写上述CSS.
Thanks to @spakmad's answer, but that's not exactly what I meant, maybe my question was not clear enough. I meant how to write above mentioned CSSs in material ui object style classes format(classes injected with withStyle HOC).
我找到了解决方法:
stepper:{
'& circle':{
fontSize: '18px'
}
}
和
stepper: {
'& .text': {
fontSize: '18px'
}
}
这篇关于如何在React和Material UI中访问更改组件内部项目的样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文