Skip to main content

Harshal V. LADHE

CSS Functions

Modern CSS functions such as `clamp()`, `min()`, `max()`, and `if()` that compute values directly in the browser.

Content tagged css-functions

  • Tutorial:contrast-color(): Automatic Readable Text on Any Background

    Let CSS choose readable white or black text automatically.
    Use CSS contrast-color() to pick white or black text for any background colour: how the spec defines it, custom properties and brand colours, buttons and tags, pairing with light-dark(), mid-tone limits, and an @supports fallback.
    Published at:
    Categories:CSS
    Estimated reading time:10 min read
  • Tutorial:The CSS shape() Function: Responsive clip-path Shapes

    Cut responsive curved shapes with CSS shape() and clip-path.
    Draw responsive clip-path shapes with the CSS shape() function: lines, curves and arcs in %, calc() and custom properties, plus browser support and fallbacks.
    Published at:
    Categories:CSS
    Estimated reading time:11 min read
  • Tutorial:CSS Custom Functions with @function: Reusable Logic Without Sass

    Native, reusable CSS functions with parameters — no Sass needed.
    Define native CSS custom functions with @function: typed parameters, defaults, fallbacks for older browsers, how they differ from Sass, and when to use them.
    Published at:
    Categories:CSS
    Estimated reading time:10 min read
  • Tutorial:HTML Attributes as Real CSS Values with Typed attr()

    Read HTML attributes as CSS colours, lengths and numbers.
    Typed attr() reads an HTML attribute as a real CSS value — type(<color>), type(<integer>), a unit like % or px, or raw-string — for any property on any element, not just text in content. Covers fallbacks for missing or invalid values, patterns for layout, transitions and view transitions, safe fallbacks in browsers without support, and when a custom property is the better choice.
    Published at:
    Categories:CSS
    Estimated reading time:11 min read
  • Tutorial:CSS-Only Staggered Animations with sibling-index() and sibling-count()

    Stagger animations from each element's own position, without JavaScript.
    sibling-index() and sibling-count() give an element its own 1-based position and its sibling total directly inside calc() — replacing the JavaScript loop that sets a --i custom property, with fixed-step and fixed-total staggers, index-driven colours and rotations, fallbacks, and reduced-motion handling.
    Published at:
    Categories:CSS
    Estimated reading time:6 min read