css-cascade Flashcards
What are the four components of “the Cascade”.
inheritance, source order, specificity,
What does the term “source order” mean with respect to CSS?
the order in which code is displayed in a style sheet
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
because of the inheritance property. mostly used for font stuff. browser put a lot of emphasis on making ealing w text easier. if there was no inheritance we would have to apply font styles to every text element.
List the three selector types in order of increasing specificity.
TYPE > CLASS > ID
specificity: its basic math
a score based on whats included in your selector
0 -1 - 2 vs 0 - 2 - 0 , think of this as ones place tens place, hundreds etc
its based on how specifically your are targeting that element
Why is using !important considered bad practice?
it’s a cheat code that forces styling to supersede previous styling. and if you want to make changes to that, you will need to keep using !important