{
  "id": 21916992,
  "title": "The beauty of CSS mixins",
  "url": "https://urgent.news/2026/11/26/the-beauty-of-css-mixins",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-26T01:02:17.000Z",
  "source": {
    "name": "Lobsters",
    "slug": "lobsters",
    "url": "https://patrickbrosset.com/articles/2026-11-25-the-beauty-of-css-mixins/"
  },
  "original_language": "en",
  "account": "CSS mixins are a new construct in CSS that allow you to define a named piece of code that can be reused throughout a stylesheet. A mixin is similar to a custom property or CSS function, but it can return multiple values at once. Instead of defining a single value like background: red; color: white; border-radius: 2px;, a mixin can return all of those values together. Microsoft is working on implementing mixins in Chromium-based browsers, and they are very close to being ready for widespread use.\n\nTo define a mixin, you use the @mixin rule, and to apply it, you use the @apply rule. Mixin names start with two dashes, like custom properties. Once defined, a mixin can be reused anywhere in your stylesheet, just like a piece of CSS code written directly in the element's style block.\n\nMixins can also accept parameters, with optional types and default values. This allows you to create reusable components that can be customized for different elements. Additionally, mixins can hold conditional rules, such as @media, @supports, and @container, making them even more versatile. For example, you can create a mixin that applies styles conditionally based on the viewport size.\n\nAnother powerful feature of mixins is the ability to accept a block of CSS from the call site using the @contents rule. This allows you to pass additional declarations or custom styles when using the mixin, giving you more flexibility in your design. Mixins can also have private variables, which are not accessible to the element applying the mixin.\n\nThe potential use cases for mixins are extensive. For example, they can be used to define styles that only apply in dark mode, or to create responsive design breakpoints with named breakpoints. In a white-label website scenario, mixins can allow customers to customize the theme while keeping the original HTML and CSS untouched. This approach offers a balance between control and customization, giving you the best of both worlds.",
  "summary": null,
  "summary_source": "publisher",
  "key_points": [],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}