CSS variables (or custom properties) help us to maintain consistent styling across our sites
We can update the variable once and the property will change wherever it is referenced
Variables also increase the readability of our CSS
:root {
--main-color: #c70039;
--secondary-color: #ffffff;
}
#three {
background: var(--main-color);
border: 4px double var(--secondary-color);
}
A CSS pseudo-class can be added to a selector to define special styles based on user behaviour
For example, if a user hovers on a button we might like to change the colour
<style>
button {
height: 20vh;
width: 40vw;
font-size: 1.5rem;
}
button:hover {
background: var(--yellow);
}
</style>
<button>Hover over me</button>
There’s a few different types of pseudo classes
Relating to anchor tags
e.g. :visited
Respond to interaction by the user
e.g. :focus
Relate to form elements, usually inputs
e.g. :valid
Relate to elements within the document tree
e.g. :root
and :first-child
As a developer, learning never stops
You’ll spend a lot of time conducting technical research and digesting