CSS stands for cascadind style sheets and cascading simply means multiple styles can be applied or multiple rules can be applied to the same element. Now this rules may lead to conflicts though. To resolve such conflicts CSS knows a concept called specificity and there are clear rules included in the CSS specification that define how such conflict should be resolved and which type of selector has a higher specificity.
ReadWhat's a rule in CSS? A rule in CSS is a combination of selector ("WHAT to style") and declaration ("HOW to style it").
ReadWe have 3 alternatives of adding CSS on a web page: we can add the css inline, using the style attribute, we can add the CSS in head tag of the page, where we put the style tag and the last alternative is to add the CSS in a separate CSS file. After we chose one of this 3 options, let's say that we chose the second or the third option because this are the most recommended alternatives, we can start writing so-called CSS rules. Our CSS rules needs to be inside of a selector. A selector simply is an additional piece of information that tells CSS to which element in your DOM, so inside of your body and the body is also treated as an element by the way, to which element you want a specific declaration.
Read