Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
148
rated 0 times [  155] [ 7]  / answers: 1 / hits: 58291  / 8 Years ago, tue, july 5, 2016, 12:00:00

I seem to be having an issue with changing the font sizes on Material-UI's (for React) RaisedButton and having the button itself scale properly with it.



<RaisedButton
label={<span className=buttonText>Log in Here</span>}
/>


CSS:



.buttonText {
font-size: 63px;
}


The text size changes but the button itself doesn't scale with it. Does anyone know the proper solution to this? I want to button to scale with the text size.


More From » css

 Answers
23

The problem is Material-UI inlines all of the styles for their components, so if you try to override them with CSS selectors it doesn't usually work quite right. Instead, try overriding whatever inline styles you don't want using the style property directly on the component. It would look something like this:



<RaisedButton style={{ fontSize: '63px' }} label='Log in Here' />



And if it still doesn't look quite right, just inspect all the generated inline styles on that component and see what you'd like to change, then just add that to the style object as well.



http://www.material-ui.com/#/components/raised-button


[#61503] Sunday, July 3, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dequant

Total Points: 88
Total Questions: 99
Total Answers: 95

Location: Ukraine
Member since Sun, Dec 13, 2020
4 Years ago
dequant questions
;