CSS Variables for React Devs

Josh W. Comeau · 2020年4月13日

AI 摘要 AI 生成,可能有误

This tutorial explores how CSS variables can be leveraged in React applications to create dynamic themes. It demonstrates how to maximize the use of CSS-in-JS tools like styled-components and challenges traditional assumptions about how media queries work.

CSS variables are *really* cool, and they're incredibly powerful when it comes to React! This tutorial shows how we can use them with React to create dynamic themes. We'll see how to get the most out of CSS-in-JS tools like styled-components, and how our mental frame around media queries has been wrong all along.

Keep reading.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Josh W. Comeau

Creating Beveled Corners with “corner-shape”

AI 摘要The article explores the new CSS 'corner-shape' property, which enables the creation of beveled corners. The author explains that unlocking its full potential requires surprisingly sophisticated techniques. They demonstrate how they used the property to achieve a retro-sci-fi aesthetic featuring diagonal corners throughout a design.

My Favourite Black Friday Deals

For many course creators, the Black Friday holiday period is when we offer the biggest discounts of the year, which means it’s a great time to pick up some of the web development courses you’ve had your eye on! This post is a quick round-up

The Future of CSS ✨

AI 摘要The article discusses the Interop project, an annual collaboration among browser vendors to synchronize their efforts on new HTML, CSS, and JavaScript features. This year, a number of exciting CSS features are being considered, and the blog post explores the future of CSS to offer a glimpse of what developers will soon be able to do.

Getting Started with Anchor Positioning

AI 摘要This article is a tutorial introducing CSS Anchor Positioning, a new feature that solves the long-standing web development challenge of attaching one element to another, such as tooltips and nested menus. The CSS Working Group has provided a first-class solution to this problem, and the author shares the most useful aspects of this modern CSS feature.

CSS vs. JavaScript

AI 摘要This blog post examines whether JavaScript animation libraries incur a performance cost compared to traditional CSS transitions and keyframe animations. The author compares the same animation implemented across several different strategies to demonstrate the differences firsthand, promising some interesting nuances in the results.