Justice for CSS
Justice for CSS / 为 CSS 正名
The first S in CSS stands for “style.” Think colors and fonts, borders and shadows, rows and columns, animations and transitions. CSS is the programming language that makes a website look pretty (or pretty ugly, often). It’s what makes this very webpage look like itself—look WIRED.
CSS 中的第一个 S 代表“样式”(Style)。想象一下颜色和字体、边框和阴影、行与列、动画和过渡效果。CSS 是一种让网站看起来美观(或者经常看起来很丑)的编程语言。正是它让这个网页呈现出现在的样子——看起来像 WIRED。
One paragraph in, a certain reader will already be smarting at my description of CSS. “It’s a style sheet language,” I can hear them say, “not a programming language.” (The second S indeed stands for “sheets,” and the C, if anyone cares, for “cascading.”) Or, “it’s a domain-specific language, not a general-purpose language.” Also, “it doesn’t execute” and, of course, “it’s not Turing complete” (although … ). Granted, CSS is a little different. There’s no compile step, and it doesn’t throw errors at run time like other languages. But that’s all beside the point.
读到第一段,某些读者可能已经对我的描述感到不满了。“它是一种样式表语言,”我仿佛能听到他们说,“而不是编程语言。”(第二个 S 确实代表“样式表”Sheets,而 C 代表“层叠”Cascading,如果有人关心的话。)或者,“它是一种领域特定语言,而不是通用语言。”还有,“它不执行代码”,当然还有,“它不是图灵完备的”(尽管……)。诚然,CSS 有点不同。它没有编译步骤,也不会像其他语言那样在运行时抛出错误。但这都无关紧要。
The gatekeeping over whether CSS is a “real” programming language exists partly because it’s so simple to start—anyone can grok “background: red” right away. But simple does not mean easy, as the programmer-writer Jeremy Keith observed, and calling CSS easy or unserious should be tired by now. There were about 50 properties in the initial CSS specification in 1996 (like “color” and “font-size”); today there are at least 10 times as many (get ready for “hanging-punctuation”). The language has changed so much in three decades, and by now it is just so capable.
关于 CSS 是否是“真正”编程语言的门槛之争,部分原因在于它上手太简单了——任何人都能立刻理解“background: red”的意思。但正如程序员兼作家 Jeremy Keith 所观察到的,简单并不意味着容易,现在再称 CSS 为简单或不严肃的语言已经过时了。1996 年最初的 CSS 规范中大约只有 50 个属性(如“color”和“font-size”);而今天,属性数量至少是当年的 10 倍(准备好迎接“hanging-punctuation”吧)。这门语言在三十年间发生了巨大的变化,如今它已经功能强大。
One programmer recently re-created Doom in CSS. Others have used it to build holographic Pokémon cards and 3D-rendering engines. Cassidy Williams, who competed in this year’s inaugural March MadCSS tournament, built an experimental database-query engine entirely in CSS. When she demo’d it at Microsoft Build, even the emcees—seasoned programmers themselves—took a cheap shot at CSS. “You’re one of the people that likes it,” they snarked. “You might be the only one.”
最近,一位程序员用 CSS 重现了《毁灭战士》(Doom)。其他人则用它构建了全息宝可梦卡片和 3D 渲染引擎。Cassidy Williams 在今年首届 March MadCSS 锦标赛中参赛,她完全用 CSS 构建了一个实验性的数据库查询引擎。当她在 Microsoft Build 大会上演示时,连主持人——他们本身也是经验丰富的程序员——都对 CSS 进行了嘲讽。“你是喜欢它的人之一,”他们挖苦道,“你可能是唯一一个。”
Why is the lore of JavaScript’s creation so famous (Brendan Eich, Netscape, 10 days) and yet hardly any programmer would recognize the name of CSS creator Håkon Wium Lie? It might have something to do with Lie being a Norwegian guy with a diacritic in his name, not an American in Silicon Valley like Eich nor a Brit like Tim Berners-Lee, who invented HTML. And to be fair, JavaScript and HTML each have a chip on their own shoulder to worry about. But in the browser’s holy ternary of JavaScript-HTML-CSS, people tend to treat CSS as less than or purely decorative. Styling can be decorative—and wonderfully so—but the legibility and rich design it affords are important. People care how things look!
为什么 JavaScript 的诞生传说(Brendan Eich、网景公司、10 天)如此出名,而几乎没有程序员能认出 CSS 创造者 Håkon Wium Lie 的名字?这可能与 Lie 是一位名字中带有变音符号的挪威人有关,他既不是像 Eich 那样身处硅谷的美国人,也不是像发明 HTML 的 Tim Berners-Lee 那样的英国人。平心而论,JavaScript 和 HTML 也各有各的烦恼。但在浏览器神圣的“JavaScript-HTML-CSS”三位一体中,人们往往将 CSS 视为低人一等或纯粹的装饰。样式确实可以是装饰性的——而且非常美妙——但它所提供的可读性和丰富设计至关重要。人们在意事物看起来的样子!
There’s another, uglier explanation for the CSS disrespect: It’s considered a “feminine” language. CSS developers work on the frontend—the part of a website you can actually see. There’s the obvious undertone that dealing with style and beauty is Female Work, along with the recycled joke that a CSS developer is “a freak in the style sheets.” How seriously a language is taken has knock-on effects on programmer salaries, what skills are sought out and tested in job interviews, and how accessible websites are for people with disabilities.
对于 CSS 受到的轻视,还有另一个更丑陋的解释:它被认为是一种“女性化”的语言。CSS 开发人员从事前端工作——即网站中你真正能看到的部分。这里有一种明显的潜台词,即处理样式和美感是“女性的工作”,再加上那个老掉牙的笑话,称 CSS 开发人员是“样式表里的怪胎”。一门语言受重视的程度,会产生连锁反应,影响程序员的薪资、面试中考察的技能,以及网站对残障人士的无障碍访问程度。
I recently talked to a friend, a talented backend engineer, about this. In college, she got an internship at a reputable software company in San Francisco doing entirely backend work. “I’d never expressed any interest in frontend at all, almost to an extreme extent,” she told me. “I don’t like frontend.” And yet, when she joined the company full-time after graduation, she was immediately assigned … a frontend role. She eventually worked her way back to the backend, and by now she’s used to the skepticism. “I’ve been in a million and one conversations with the classic man engineer who doesn’t think I know what I’m talking about until they work with me for six months and see my first backend project.”
最近,我和一位才华横溢的后端工程师朋友聊到了这个问题。在大学时,她在旧金山一家知名软件公司实习,完全从事后端工作。“我从未表达过对前端的任何兴趣,甚至到了极端的程度,”她告诉我,“我不喜欢前端。”然而,毕业后她全职加入该公司时,却被直接分配到了……一个前端岗位。她最终通过努力回到了后端,现在她已经习惯了这种怀疑。“我经历过无数次与那种典型的男性工程师的对话,他们总觉得我不懂行,直到他们和我共事六个月并看到我的第一个后端项目。”
I didn’t know this specific story when I first asked my friend if, maybe, I dunno, she had any experience with people assuming she was a CSS girlie. But the “coincidence” is really more of a probability. To overcorrect for such situations, she’s taken to branding herself as unmistakably backend-y. When we worked together, whenever it came time to distribute tasks among our team, she made it quite clear that she did not want to touch the frontend. (I don’t think we ever played Nose Goes, but that was the spirit.) I’d have been seriously obtuse to make the same mistake her manager did.
当我第一次问朋友是否曾被人误以为是“CSS 女孩”时,我并不知道这个具体的故事。但这种“巧合”其实更像是一种概率。为了纠正这种情况,她开始将自己明确地打上“后端”的标签。当我们一起工作时,每当需要分配任务,她都会明确表示不想碰前端。(我不认为我们玩过“谁慢谁倒霉”的游戏,但就是那种心态。)如果我犯了和她经理一样的错误,那我就太迟钝了。
That same friend used to teach at Kode With Klossy, a tech camp for young women and gender-expansive students started by supermodel Karlie Kloss. Her experience there was all about the other, optimistic side of the coin: CSS can be a gateway into software for those who don’t fit the nerdy-computer-boy stereotype. “These girls would come in who had no interest in coding but just thought that Karlie Kloss was cool, and they would have so much fun,” she said. “They would grow to care more about, like, OK, how does this work?”
这位朋友曾在一所名为 Kode With Klossy 的科技夏令营任教,这是由超模 Karlie Kloss 为年轻女性和性别多元学生创办的。她在那里获得的经验展示了硬币的另一面,即乐观的一面:对于那些不符合“书呆子电脑男孩”刻板印象的人来说,CSS 可以成为进入软件行业的门户。“这些女孩进来时对编程毫无兴趣,只是觉得 Karlie Kloss 很酷,但她们玩得很开心,”她说,“她们会逐渐开始关心,比如,好吧,这是怎么运作的?”
Within the industry, the Klossy approach is reflected in slightly better (but still really bad) gender diversity in front-of-the-frontend engineering jobs, compared to back-of-the-frontend and pure backend roles. Of a few thousand respondents in the State of CSS survey last year, 11 percent were women and 3 percent were nonbinary or gender-nonconforming. Pathetic, I know. But the State of JavaScript reported only 6 percent female and 1 percent nonbinary.
在行业内部,Klossy 的方法反映在“前端的前端”(front-of-the-frontend)工程岗位上,其性别多样性略好(但仍然很糟糕),相比之下,“前端的后端”(back-of-the-frontend)和纯后端岗位则更差。在去年《State of CSS》调查的几千名受访者中,11% 是女性,3% 是非二元性别或性别不符合者。我知道这很可怜。但《State of JavaScript》报告显示,女性仅占 6%,非二元性别者仅占 1%。
Another downstream consequence of CSS neglect is the sameness of websites across the internet, especially in Startup-land. If CSS is what makes a website look like itself, then the more recent fast fashion of frameworks is what makes them all look alike. There was a Bootstrap era, a Tailwind look, and now a distinctive Claudeslop aesthetic. Frameworks are athleisure, and if you’re not into fashion, they’re a shortcut to looking OK. Fair enough. But it does bum me out, in the same way the grayification of American cars bums me out compared to those old pho…
忽视 CSS 的另一个后果是互联网上网站的同质化,尤其是在初创企业领域。如果说 CSS 是让网站呈现独特个性的东西,那么最近流行的框架快时尚则是让它们看起来千篇一律的元凶。曾经有过 Bootstrap 时代,有过 Tailwind 风格,现在则有一种独特的“Claude 垃圾审美”(Claudeslop aesthetic)。框架就像运动休闲装,如果你不追求时尚,它们就是让你看起来“还行”的捷径。这倒也无可厚非。但它确实让我感到沮丧,就像美国汽车的“灰色化”让我怀念那些老式汽车一样……