CSS Quick-Tip: Custom Properties Fallback Values

Поделиться
HTML-код
  • Опубликовано: 27 июл 2024
  • A quick tip outlining how and why you can define fallback values for CSS Custom Properties, which can be useful when you're dealing with larger projects and design systems that contain many CSS Variables.
    🔗 Links
    Demo: codepen.io/ZoranJambor/pen/LY...
    Why do we define Custom Properties on :root in CSS: • What exactly is :root ...
    📖 Chapters
    00:00 Why you need fallback values for Custom Properties
    00:38 How to define fallback values for Custom Properties
    01:10 How to define multiple fallback values for CSS Variables
    Subscribe to CSS Weekly Newsletter:
    💌 css-weekly.com/
    Course Mastering Prettier & Stylelint
    🔥 Learn everything about best linting tools while supporting CSS Weekly: masteringlinting.com/
    🏷️ Use coupon code RUclips15 to get an additional 15% off on the already discounted, pre-launch price.
    Keep up-to-date with CSS Weekly:
    👉 Twitter: / cssweekly
    👉 Instagram: / cssweekly
    👉 Facebook: / cssweekly
    Keep up to date with what I'm up to:
    🔗 Blog: zoranjambor.com
    👉 Twitter: / zoranjambor
    👉 LinkedIn: / zoranjambor
    - Zoran Jambor
    #css #csstips
  • НаукаНаука

Комментарии • 8

  • @D7460N
    @D7460N Год назад

    Didn't know this! So cool. Thanks for posting!

    • @CSSWeekly
      @CSSWeekly  Год назад

      I’m thrilled to hear this! Thanks so much for watching and for your feedback! 🙏

  • @egorkloos
    @egorkloos Год назад +1

    I particularly like the effect of placing a comma and no value, as it then resolves to nothing.

    • @CSSWeekly
      @CSSWeekly  Год назад

      Yes, indeed. I probably should have mentioned this. 🙂
      But still, it seems like an anti-pattern. It looks wierd, like a mistake: cln.sh/kvsMnRHg 🙂

  • @ahmad-murery
    @ahmad-murery Год назад

    It's not weird that my comment got deleted, YT has been doing this to me a lot recently.
    In short words, what I was saying is that I usually define a custom properties for my component (in its own css file) and then override them as needed from my main css file.
    anyway, thanks Zoran!

    • @CSSWeekly
      @CSSWeekly  Год назад +1

      Thanks for the comment and heads-up about RUclips deleting your comments, Ahmad! I've pre-approved all your comments, so it should no longer happen on this channel. 🙂
      Tha's an interesting approach, thanks for sharing! 🙏

    • @ahmad-murery
      @ahmad-murery Год назад

      @@CSSWeekly That's very kind of you,
      Thanks Zoran!

    • @CSSWeekly
      @CSSWeekly  Год назад +1

      Thank you, Ahmad, for always sharing your perspective here! 🙂