logoalt Hacker News

lioeters • today at 3:16 AM • 1 reply • view on HN

Do we really want functions in CSS? I guess that ship has sailed a while ago, since CSS reached Turing completeness.

  /* Define a function: */
  @function --gradient-to-transparent(--color, --direction: bottom) {
    result: linear-gradient(
      to var(--direction),
      var(--color),
      transparent;
    );
  }
Why not provide better integration with JavaScript, to make this kind of acrobatics unnecessary.

Replies

afavour • today at 3:25 AM

Because JavaScript requires… a lot. A virtual machine, script parsing, etc. Making that a requirement before you even display any content on the page would be a regression.

➕ show 3 replies