Skip to main content
CSS-Tricks
Since 2007
  • Articles
  • Guides
  • Almanac
  • Links
  • Picks
  • Newsletter
  • Search

Articles Tagged
CSS functions

32 Articles
{
,

}
Direct link to the article @function
CSS functions

@function

The @function at-rule defines CSS custom functions. These custom functions are reusable blocks of CSS that can accept arguments, contain complex logic, and return values based on that logic.
Declan Chidlow on Jun 3, 2026
Three cards displaying streaming services with a base monthly price and a discounted price.
Direct link to the article Computing and Displaying Discounted Prices in CSS
CSS functions math functions

Computing and Displaying Discounted Prices in CSS

A clever use of CSS to calculate and display a discounted product price by providing a base price and discount amount, featuring modern CSS features like attr(), mod(), and round().
Preethi on May 14, 2026
A photo of rolling dice against a blue background,
Direct link to the article The Importance of Native Randomness in CSS
CSS functions random

The Importance of Native Randomness in CSS

We're getting new functions for generating random numbers in CSS! But the road to get here has been a long and winding one.
Alvaro Montoro on Apr 30, 2026
Three rectangular shapes with jagged, non-creating edges. the first is blue, then orange, then green.
Direct link to the article Making Complex CSS Shapes Using shape()
clip-path CSS functions css shapes shapes

Making Complex CSS Shapes Using shape()

Creating rectangles, circles, and rounded rectangles is the basic of CSS. Creating more complex CSS shapes such as triangles, hexagons, stars, hearts, etc. is more challenging but still a simple task if we rely on modern features.
Temani Afif on Apr 2, 2026
A vertical column of folders with labels on the right fanned out and curving towards the right.
Direct link to the article Abusing Customizable Selects
CSS functions html elements select

Abusing Customizable Selects

Let’s go over a few demos using the new customizable <select> feature that may be wild, but also give us a great chance to learn new things in CSS.
Patrick Brosset on Mar 11, 2026
Direct link to the article Spiral Scrollytelling in CSS With sibling-index()
CSS functions GSAP Scroll Driven Animation

Spiral Scrollytelling in CSS With sibling-index()

Lee accepts a challenge: arranging text in a spiral that animates as a vortex on scroll... all in CSS.
Lee Meyer on Feb 17, 2026
A grid of hexagon shapes of equal size that alternate between blue and red. Each shape is labelled by it's order in the grid.
Direct link to the article Responsive Hexagon Grid Using Modern CSS
CSS functions math shapes

Responsive Hexagon Grid Using Modern CSS

A while back, Temani tacked a repeating grid of hexagon shapes. Well, he's updated it with modern CSS features that result in fewer magic numbers. And it's impressive!
Temani Afif on Jan 23, 2026
Direct link to the article Creating Scroll-Based Animations in Full view()
CSS functions Scroll Driven Animation

Creating Scroll-Based Animations in Full view()

It’s not that hard to do! Preethi shows you how it's really the same old animation you’re used to writing in CSS, only applied on a view timeline instead of a normal timeline.
Preethi on Dec 10, 2025
Direct link to the article The Range Syntax Has Come to Container Style Queries and if()
container-queries CSS functions media queries Style Queries

The Range Syntax Has Come to Container Style Queries and if()

Being able to use the range syntax with container style queries — which we can do starting with Chrome 142 — means that we can compare literal numeric values as well as numeric values tokenized by custom properties or the attr() function.
Daniel Schwarz on Nov 13, 2025
  • 1
  • 2
  • 3
  • ...
  • 4
  • Older

CSS-Tricks is powered by DigitalOcean.

Get Curated Front-End Roundups Right in Your Inbox

Coming back really, really soon! See past issues →

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

Wait! Don't Go Yet 🚀

Get our FREE eBook "10 Programming Tips That Changed Everything" when you subscribe!

No spam. Unsubscribe anytime.