Best Practice for overriding css styles without modifying the original files

Hey,

I have added a custom css file as I didnt want to change the css rules in one of the original theme files.
I am wondering what the best practice in this case is. Do I really have to use !important everywhere? Or am I missing something and it would be better to modify the original files? (I guess this would lead to problems when updating the theme)

Thanks

Hello @juliandewert ,

Custom css file is a best approach.
You need to use !important where it needed no need to use it every property.

Thanks

1 Like

Thanks for the quick answer.

Yeah of course it is only required when you are overwriting a rule.

Just out of interest:

When developing themes on other platforms your styles are often loaded at the end, so there is no need for !important.
Are there any advantages using the shopify approach?

I think we load the styles in the start within the head tag.
And its benefit is that the page loads faster.

1 Like