Default CSS properties and how it works

Tell us what’s happening:
This is a bit obv question but I want the opinion of someone who is more experienced
When I apply CSS classes the buttons aspect changes, now I notice that just change a few things for example the border and the background
The default background color is white, now when I change it , nothing else change that and keep other default values, like border
So to change something you just have to give it a class and start working on CSS, but the CSS just apply the changes that you specify on each class , for example I didn’t change the text on the button with CSS but I did change de border and the background that’s why the border and the background changes and the text keeps default font size and font family, right?


Generally speaking yes, but it can be a bit more complex than that.
Certain values in addition to being default, can also be inherited from its nearest ancester element. Check MDN doc about inheritance

But in your specific question, if you have not modified the value with a selector directly, CSS will find a default value.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.