Day 66 - The Power of Custom CSS Functions
Emiliano Pisu
?? Sensei & Co-Host @ DevDojo IT ?? Speaker ?? Accessibility WCAG Expert ? Turning Designs into interactive things ??♂? Your friendly neighborhood Design Engineer
?? An Awesome CSS Link a Day – Day 66 ??
Unlocking the Power of Custom CSS Functions
#AnAwesomeCSSLinkADay #YouDontMessWithCSS #CSS
Ever thought about writing functions directly in CSS? With the rise of custom CSS functions, we’re stepping into a future where styles can be more dynamic, reusable, and flexible than ever before. Let’s break down what CSS functions can do and why they’re a game-changer for modern web development.
?? Theory: Defining and Using Functions in CSS
CSS has always had built-in functions like calc(), var(), and clamp(), but custom functions take things further, allowing greater abstraction and reusability. They bring a programmatic approach to styling, making CSS feel more like a real programming language. There are even pseudo-function, widely named pseudo-classes but I prefer to call them functions as they can get parameters, for example we got: the :not(), :is(), :where(), :has(), :nth-child() which behaviors are slightly different than :hover, :active, :disabled and so on. That's why I prefer to call them pseudo-functions instead of pseudo-classes.
But the CSS ecosystem is about to get a significant update: the ability to create custom function, as we already are able to do with custom properties.
?? Today’s Link
For a deep dive into CSS functions and their potential, check out this insightful article from CSS-Tricks:
?? Giveaways
? Why This Rocks
??? Join the Conversation
Let's explore how CSS functions are shaping the future of styling! ??