You should override by increasing Specificity of your styling. There are different ways of increasing the Specificity. Usage of !important
which effects specificity, is a bad practice because it breaks natural cascading in your style sheet.
Following diagram taken from css-tricks.com will help you produce right specificity for your element based on a points structure. Whichever specificity has higher points, will win. Sounds like a game - doesn't it?
Checkout sample calculations here on css-tricks.com. This will help you understand the concept very well and it will only take 2 minutes.
If you then like to produce and/or compare different specificities by yourself, try this Specificity Calculator: https://specificity.keegan.st/ or you can just use traditional paper/pencil.
For further reading try MDN Web Docs.
All the best for not using !important
.