Summary
We’ve had a good look at custom properties in this chapter, and considered ways in which they can be set and read. We have learned how custom properties respect the cascade, inheriting values from their parents, a feature that can be leveraged to our advantage. We have also considered the fact that if we find ourselves working with web components, custom properties provide a means of crossing the usually impenetrable style boundary inside a component. We also looked at environment variables, a specific kind of custom property that lets us deal with the (clears throat) “practicalities” of notches and other peculiarities of specific hardware.
In the second half of the chapter, we also looked at CSS mathematical functions. From ones you have perhaps looked at before, such as calc()
, to real time-saving functions like clamp()
, a function that is tailor-made to solve responsive sizing challenges.
We’ve spent a bit of time together at this point...