Sider
component of Ant Design provides property width
for setting width in js/JSX. However this width overrides any width specified in css via ant-layout-sider
selector. Hence, I was wondering how can I specify width within css instead of js? I know about the !important
rule in css, but I try to avoid it, hence I was wondering if there are alternative solutions?
Asked
Active
Viewed 3,840 times
1

arslancharyev31
- 1,801
- 3
- 21
- 39
1 Answers
0
There is nothing wrong with using !important
, it was original created as an override.
back in the 19-something, browsers each had their own stylesheets and web authors had this feature for css created, meaning that any attribute with !important
would override the browser existing css code, moving on to 2019, it is still a common and acceptable practice.
on another note.
why don't you try using SASS instead of CSS, it is more dynamic and has a lot more options, you can mix and match css and sass files together.
refs:

Dean Van Greunen
- 5,060
- 2
- 14
- 28
-
I am using sass. But what does relevance does it have with the question? Sider overrides both css/sass/etc... – arslancharyev31 Jul 19 '19 at 13:37
-
@arslancharyev31 have a look at [Ant Design Styles](https://stackoverflow.com/questions/48620712/how-to-customize-ant-design-styles) – Dean Van Greunen Jul 19 '19 at 13:39
-
Ok, so if I unnderstood correctly, without it is only possible via LESS, not CSS/SASS? – arslancharyev31 Jul 19 '19 at 13:47