Inheritance in CSS is simple to understand. If a parent tag has some styling, then every child tag inside will try to inherit the styling of that parent tag if possible. Notice how I said “try to inherit”, which means not all properties get inherited. The elements that do get inherited are mostly related to text: font-family, font-size, font-weight, font-style, color, etc. Also, if the child tag has styling that would contradict the styling attributes of their parent tag, then the child styling will override their inherited styling.

The Universal Selector isn’t often used, but when it is used, its to apply maybe one or two styling to every element possible, but any other styling from other elements will override whatever conflicting elements the Universal Selector has.

By Levi

Leave a Reply

Your email address will not be published. Required fields are marked *