CSS Styling a button does not yield the desired outcome

When trying to incorporate a new page into an existing website with corporate styling, I came to a problem which was hard to detect (for me). A newly created button should have a slightly different position and edge rounding than all other styled buttons as it comes from a different context. Whatever I've done, I never got the correct styling, like magically ignored by the browser. Learning about the developer console I digged deep into the css styling and found out that a <div> from a container forced its own styling on the button. Some changes work whereas some changes are ignored because they are overwritten by the super div. A very hacky and in general practice bad way to solve this problem was to apply the `!important` tag which then really applied the changes. Reading through some articles, my use case was actually well suited for the `!important` tag because it really stands out in the context.

Comments

I think most of the developers that work with CSS have stumbled upon this specific problem. It is usually a bit challenging initially, but in general it does not require a lot of time or complexity to be solved.
Savvas Yiannopoulos - Fri, 11/23/2018 - 18:58 :::
It might be considered a hack, but it has its place. Even !important is just another tool in the toolbox. As long as it does its job consistently everything is fine
Klaus Nigsch - Sun, 11/25/2018 - 13:06 :::
I did not have to use this tag till now, maybe in the future if I face some similar problems I can use it. Thank you for sharing.
Malbora Sinaj - Sun, 12/09/2018 - 16:49 :::
Working with huge CSSs stylesheets can be really challenging at the beginning, especially when you don't know which part of the code caused your changes to be ignored / behave unexpectedly. I would also suggest. I have not used this before but I ran into similar situations and then it was just a case of changing some property of the "super" div, provided it did not break anything. In general, I agree that even "hacks" have their place.
Angelos Arampatzis - Mon, 12/10/2018 - 15:22 :::
1 answer

It might be considered a hack, but it has its place. Even !important is just another tool in the toolbox. As long as it does its job consistently everything is fine