Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
160
rated 0 times [  163] [ 3]  / answers: 1 / hits: 138077  / 10 Years ago, tue, april 15, 2014, 12:00:00

It's there a way to add inline styles with the !important override?



style={
height: 20+'!important'
};

<div style={style}></div>


This isn't working as I would have hoped.


More From » reactjs

 Answers
7

20+'!important' is '20!important'.



When you just give a number, react adds px for you; but you're using a string, so you have to specify the unit. Also I'm pretty sure there needs to be a space between !important and whatever's to the left of it.



style={{ height: '20px !important' }};

[#71458] Sunday, April 13, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jazlynnessencec

Total Points: 434
Total Questions: 113
Total Answers: 94

Location: Norway
Member since Mon, May 23, 2022
2 Years ago
;