CSS Order of layers

Hello! So I have a question on how to change the order of applying layers.Untitled
I need the “eighth–st” to overwrite the “value” class. I can do this by simply place these classes in one css file and place “value” on top of the file to be overwritten, but the problem that I have a hell lot of classes, so I want to separate them in different files and then import in one css file.
So the question is how to make the order of applying after importing.

This is where the “C” in CSS comes in = “Cascading”.

There are a lot of things that impact precedence of styles. Inline styles (in the html element itself) have the highest precedence. Styles declared in the html file are higher than those in linked files. More specific selectors have precedence over less specific selectors, and selectors of equal specificity will give precedence to the one declared later in the stylesheet. Two stylesheets that both provide styling with identical selectors, both on the first line? The stylesheet that was linked second wins! (This is non-exhaustive and I’m not even going to the !important discussion. )

Now that I’m done ranting… The policy you want to use is specificity.

My case: I have generated a lot of div nodes that have “value” class on default, and sometimes I need to put the image to particular divs and change margin accordingly.
Thank you, but I’m afraid I have to just put it in the same css file.

I found this diagram useful:

1 Like

Hahah, thank you) I don’t need that much information.