Skip to main content
CSS-Tricks
  • Articles
  • Notes
  • Links
  • Guides
  • Almanac
  • Picks
  • Shuffle
Search

Articles Tagged
functions

12 Articles
Direct link to the article Quick Hit #38
functions

Quick Hit #38

Chrome has delayed shipping @function to Chrome 139! A wise choice, if you ask me; functions will set a before and after in CSS.…

Juan Diego Rodríguez on Mar 9, 2025
Direct link to the article Functions in CSS?!
functions

Functions in CSS?!

Arguments?! Return values?! What's crazier, you can use functions right now in Chrome Canary! So, after reading and playing around, here are my key insights on what you need to know about CSS Functions.
Juan Diego Rodríguez on Mar 3, 2025
Direct link to the article The What If Machine: Bringing the “Iffy��� Future of CSS into the Present
functions

The What If Machine: Bringing the “Iffy” Future of CSS into the Present

My thesis for today's article offers further reassurance that inline conditionals are probably not the harbinger of the end of civilization: I reckon we can achieve the same functionality right now with style queries, which are gaining pretty good browser support.
Lee Meyer on Feb 17, 2025
Direct link to the article Typecasting and Viewport Transitions in CSS With tan(atan2())
functions view transitions

Typecasting and Viewport Transitions in CSS With tan(atan2())

We’ve been able to get the length of the viewport in CSS since… checks notes… 2013! Surprisingly, that was more than a decade ago. Getting the viewport width is as easy these days as easy as writing 100vw, but …

Juan Diego Rodríguez on Feb 3, 2025
Direct link to the article random()
functions random

random()

The random() function in CSS is an experimental feature (i.e., not supported in any browser) that returns a random numeric value or random choice among multiple values from a range you specify. It works the same as JavaScript’s Math.random function…

Sunkanmi Fafowora on Jan 7, 2025
Direct link to the article Come to the light-dark() Side
dark mode functions UI/IX Design

Come to the light-dark() Side

Dark mode interfaces have matured a lot in the past few years. We all know the "traditional" approach using media queries but in this article, Sara Joy demonstrates modern CSS features that make respecting user color scheme preferences pretty darn easy.
Sara Joy on Oct 29, 2024
Direct link to the article Quick Hit #22
functions

Quick Hit #22

Adam’s got this idea for a CSS syntax based on functional notations. Some “hate” it (Sass baggage) but we’re already sorta moving that way. Perhaps shorthand properties become shorthand functions?…

Geoff Graham on Sep 24, 2024
Direct link to the article CSS Functions and Mixins Module Notes
csswg functions mixins

CSS Functions and Mixins Module Notes

Most days, I’m writing vanilla CSS. Thanks to CSS variables and nesting, I have fewer reasons to reach for Sass or any other preprocessor. The times I reach for Sass tend to be when I need a @mixin to loop …

Geoff Graham on Aug 1, 2024
Direct link to the article Calculate Viewport Size in CSS
custom properties functions viewport units

Calculate Viewport Size in CSS

A way to calculate the viewport’s width and height without JavaScript, by way of Temani Afif over at CSS Tip:

@property --_w {
  syntax: '<length';
  inherits: true;
  initial-value: 100vw; 
}
@property --_h {
  syntax: '<length';
  inherits: true;
  
…
Geoff Graham on Jul 17, 2024
  • 1
  • 2
  • Older

CSS-Tricks is powered by DigitalOcean.

Keep up to date on web dev

with our hand-crafted newsletter

DigitalOcean
  • About DO
  • Cloudways
  • Legal stuff
  • Get free credit!
CSS-Tricks
  • Contact
  • Write for CSS-Tricks!
  • Advertise with us
Social
  • RSS Feeds
  • CodePen
  • Mastodon
  • Bluesky
Back to Top