CSS Flashcards
What are CSS Combinators? List the 4 available
Additional CSS Selectors that combine with an initial CSS Selector • Descendant selector (space) • Child selector (>) • Adjacent sibling selector (+) • General sibling selector (~)
What is a CSS pseudo class?
Defines a special state of an element, for example when an element is hovered over (:)
What is a CSS pseudo element?
A CSS pseudo-element is used to style specified parts of an element, for example styling the first letter or line of an element (::)
What is CSS specificity?
A set of rules that determine which style declarations are ultimately applied to an element.
What is the CSS specificity hierarchy?
- Inline styles
- IDs
- Classes, attributes and pseudo-classes
- Elements and pseudo elements
What are CSS Modules?
CSS files that can be imported into JS files that are scoped locally as opposed to globally, by using module loaders and giving class names unique identifiers
How can you enforce global styling in CSS modules?
Using the global
keyword, for example:
:global .button {
…
}
What is composition in CSS modules?
You can reference classes from the same file or external dependencies and get all the styles applied to the element. For example;
.background-red {
background-color: #ff0000;
}
.button {
composes: background-red;
font-size: 12px;
}