Here's how CSS counting for selectors works.
The inline style has surpassed everything in CSS. eg. <p style="margin:0;"> override everything in your CSS file.
Identifier: 1000 points: # subtitle, # page-wrapper Class is considered 100 points Z: .sub-head, .page-wrapper Elements are counted as 10 points: a, p, div, ul, li Pseudo-elements are counted as 1 :: hover ,: first-child: last-child
Which of the selectors ever selected has the highest number of dots for the style will be displayed on the page.
! important is another trump card for drawing and should only be used rarely. For example, I like to use it to color special text or fields.
Here is a good link that explains this in more detail. It is very simple.
Link
source share