CSS 发明者 Håkon Wium Lie 访谈(一)

导语:本人利用业余时间翻译。受本人水平所限,当中错谬不少,还望大家斧正!

原文地址:https://dev.opera.com/articles/css-twenty-years-hakon/

---------------------------------------------------------------------------------------------------------------------

二十年前的今日,Opera 的 CTO Håkon Wium Lie 推出了 HTML 层叠样式的第一个草案:CSS(下面的文字过于文艺,非本人能力所及,不如不译了……)

Twenty years ago today, Opera’s CTO Håkon Wium Lie published Cascading HTML style sheets – a proposal. If Paul McCartney were a web developer, and writing ‘Sergeant Pepper’s Lonely Hearts Club Band’ today, he would almost certainly write:

It was twenty years ago today
That Håkon wrote a doc to say
That if the Web’s gonna last a while
Then we need a way to define style.
So may I introduce to you a way to add visual treats:
It’s Sergeant Håkon’s Cascading Style Sheets!

However, when we went round to Paul’s house to ask him to sing this for us, he declined and set his guard dogs, FontTag and Bgcolor, on us. So, instead, to mark this occasion, Bruce sat down with Håkon to ask a few questions about the past, present and future of CSS.

CSS 诞生了二十年了。如同家有儿女初长成,你会感到十分开心吗?
CSS was conceived twenty years ago. Are you happy about how your baby, child and teenager has turned out?

是啊,我当然十分开心。CSS 是Web 基石之一而且 Web 页面越来越漂亮也可以说归功于 CSS。事实上 HTML 与 CSS 之间健康的相互发展是相得益彰的。同时,对于接下来的发展,仍有相当多的空间。
Yes, I’m very happy with CSS. CSS is a cornerstone web specification and web pages are more beautiful as a result of CSS being there. The fact that HTML is still alive and well is also a testimonial to the success of CSS. As with all youngsters, however, there is room for improvement.

你说过“CSS 拯救 HTML”,此话何解?
You’ve been quoted as saying you proposed CSS “to save HTML”. Please explain.

CSS 的缺席会让 HTML 世界显得不仅仅是寂寞,而且贫瘠。那时候 Web 开发者都是从桌面程序员过度而来的,包括我也是,那时甚至连 <color> 或 <font> 标签都没有。我想起我第一幅公开的 Web 页面,没有恰当的手段于是只能令图片文本化。那时候我记得是 1993 年。如果没有制定这些标准如果 CSS 没有出现,HTML 将会变得迥然不同,Web 将会变成一个只传递文本图片的巨大传真机。对失明者或搜索引擎来说,Web 将会是一片可怕之地。CSS 提供了一个可以表达作者设计意图的方式,而不需要添加新的 HTML 标签。
HTML would have been very different if CSS had not appeared. Authors who came to the web from a desktop publishing background were baffled by the lack of <color> and <font> tags. Including myself. In my first real publication on the web, I resorted to making images with text in it — you can see it in this publication from 1993. If this development had continued, the web would have become a giant fax machine where pictures of text would be passed along. This would have been terrible for blind users and search engines alike. CSS was proposed to prevent this development by giving authors a way to express their designs without adding new HTML tags.

在第一份草案中,还有百分比的影响符,如 h1.font.size = 24pt 100%,说明如下:
In the first proposal, there was a percentage of influence specifier, e.g. h1.font.size = 24pt 100%, described as follows:

在行尾的百分比表示需求的影响程度(此处100%)。如果这是初始样式表(即在用户控制下的一个),该需求可被满足,即,所有的标题元素将使用 Helvetica 字体。如果该语句是在一个更高的样式表,任何未声明的子级都会受影响。
The percentage at the end of the line indicates what degree of influence that is requested (here 100%). If this is the initial style sheet (i.e. the one under user control), this request can be fulfilled, i.e. all headline elements will be rendered using Helvetica. If the statement comes in a later style sheet, any unclaimed influence is granted.

后来为何放弃?
Why was this dropped?

你指的机制是尝试把作者和读者的喜好和需求结合起来。它设计灵感来自麻省理工学院媒体实验室的想法:在未来的电视不会有亮度和色彩控制,但对于色情,暴力,或者左翼和右翼内容敏感。 CSS 的建议是弹性的,让作者自己来,决定取舍。在这期间,浏览器会尝试混合的需求,使每个人都高兴。这非常适用于某些属性(如字体大小 font-size),但某些就不适合(如 font-family 的)。对于这份草案的想法,Bert 进行了批评(此处大家将就吧,太难翻译了……):
The mechanism you refer to was there to try combine the needs and preferences of both authors and readers. It was inspired by an idea from the MIT Media Lab: TVs in the future would not have controls for brightness and color, but for sex and violence, or left-wing and right-wing, perhaps. The CSS proposal was to have sliding scale where the author was fully in charge in one end of the scale, and the user was fully in charge in the other end of the scale. In between, the browser would try to mix requests to make everyone happy. This works well for certain properties (like font-size) but is hard to do for others (like font-family). In his first response to the CSS proposal, Bert criticized this idea:

The idea that two designs can be averaged to come up with an intermediate style seems utterly wrong to me. What happens when my blue-on-yellow style is combined with somebody else’s yellow-on-blue? Do I get green-on-green? Or who wants to look at a page with Avant-garde titles over Helvetica paragraphs?

I responded:

Some attributes mix better than others. A typical use of “weighted average” is to soften the author’s attempt to be distinct, e.g. the suggested font sizes – while the user still gets the message. One doesn’t have to use this feature, but while “100%” is equal to a binary “1” there is no going back from a binary syntax. In general, I think computer interfaces are much too binary.

Of course, Bert was right (he is, almost always) that the proposal created more problems than it solved, and the mixing was dropped.

有点像 JS 风格,后来为什么改了?
Ditto the JS-style dot syntax. Why did it change?

你管这个叫 JS 风格,有意思。不过那时候 JavaScript 好像还没有那么普及吧,所以我也不可能参照那玩意。我是用 X11 Windows 系统的 X 资源得到灵感的,那是一个 MIT 的项目。
It’s interesting you call it JS-style syntax. When I first proposed CSS, JavaScript was not around so I couldn’t borrow it from there. Rather, the syntax was inspired by X resources from the X11 Window System, another inspirational project coming out of MIT.

之所以把 CSS 语法从 font.size转换到 font-size,是基于两方面的原因:一、使用分隔符看起来更像在书写英语,增加了可读性;二、DSSSL 和 DSSSL-Lite 都采用分隔符作为属性名。James Clark,写了第一份 DSSSL-Lite 的人,参见了 W3C 工作组的层叠样式,我和 Bert 就在 DSSSL 身上借用了分隔符。从缺点来说,就是分隔符看起来像数学的减号,解析器会分不清。
The reason for changing the CSS syntax from font.size to font-size was twofold. First, the hyphen makes it look more like written English, which improves human readability. Second, DSSSL and DSSSL-Lite used hyphenated property names. James Clark, who wrote the first draft of DSSSL-Lite, participated in the first W3C workshop on style sheets, and Bert and I borrowed the hyphen from DSSSL. On the downside, the hyphen represents minus in math, which sometimes confuses parsers.

时间: 2024-10-14 16:43:49

CSS 发明者 H&#229;kon Wium Lie 访谈(一)的相关文章

CSS 发明者 H&amp;#229;kon Wium Lie 访谈(二)

Bert Bos 如何参与进来的,你们怎么一起工作的?How did Bert Bos get involved, and how did you work together? 伯特·波斯回顾我的初步建议.他的背景和重点是与我的有点不同,但是当他写了自己的建议,我们很快就意识到,这两项建议可以合并成一个.在这一点上,网络项目被踢出欧洲核子研究中心的出来,W3C 成立.我开始了 W3C 的 INRIA 欧洲分公司和 Bert 立即被录用.大多数 CSS1 被敲定在索菲亚 - 安提波利斯白板在199

CSS 发明者 H&amp;#229;kon Wium Lie 访谈(三)

如果你手上有魔棒,你会发出什么的魔咒,让 CSS 按照你的想法走?另外,还有什么你想搞进来的,而且又会受到大家欢迎的?If you could wave a magic wand, which bit of current CSS would you banish from the world, and what would you magically add and implement everywhere? 首先,我会把浏览器专属特定的代码干掉,像 <!--[if lt IE 7 ]> 诸

网页代码中H型标签与CSS调用H型标签探讨!

中介交易 http://www.aliyun.com/zixun/aggregation/6858.html">SEO诊断 淘宝客 云主机 技术大厅 大家好我是上海SEO(SWJ) 今天与大家一起探讨 在网页代码中 使用DIV+CSS布局中的CSS调用H型标签 与网页原本的H型代码 之间的关系 是否与SEO过度优化有联系,对搜索引擎抓取之间的联系! 我们就拿上海SEO顶部的介绍代码来分析下:<div id="info"><h1>上海SEO(seo

mfc-关于afxcomctl32.h错误,求助

问题描述 关于afxcomctl32.h错误,求助 一共有106个相关错误: 错误 1 error C2504: "CNoTrackObject": 未定义基类 c:program files (x86)microsoft visual studio 10.0vcatlmfcincludeafxcomctl32.h 174 错误 2 error C2146: 语法错误: 缺少";"(在标识符"m_strModuleName"的前面) c:prog

不要再在JavaScript中写 CSS了

本文作者是 react-css-modules 和 babel-plugin-react-css-modules 的作者.并不是对 CSS in JavaScript: The future of component-based styling,或是使用样式组件的反对,而是一种补充,web 开发者要了解自己的需求,明白自己使用 styled-components 的真正原因. 9 个谎言 CSS 不应随意放置.许多项目选择将样式写在 JavaScript 中的理由不对.本文列出了常见的误解,以及

DHTML【7】--CSS

    本节将要介绍CSS的选择器,CSS有三种常用的选择器,还有三种扩展选择器,说到选择器,那么选择器是做什么用的呢?       上一节我们介绍CSS常用属性的时候,我们都是通过在标签内定义Style属性来介绍的,但是如果Style中的属性有很多,并且我们还要把相同类型的标签用同一个CSS样式来美化,我们总不能Copy代码吧,首先页面太乱,再者代码量大,在大型的网站开发中会影响执行效率,最后自己操作起来也很麻烦,遇到这个问题,我们改怎么解决呢?       这就是选择器要做的事情,我们可以先

javascript线性渐变一_javascript技巧

作为新力军,苹果为我们带来了canvas标签.canvas首次在Mac OS X中的Dashboard中被引入,之后又被苹果公司的Safari浏览器所支持,紧接着就成为HTML5的标准,被IE内核以外的标准浏览器所支持.苹果做的好事还不止这一桩,它认为SVG太笨重了,于是它把SVG里的滤镜标签统统CSS属性化(SVG的滤镜比IE滤镜还多呢,而且功能更全面).firefox一看不对劲,连忙自己也搞一套私有属性,只不过是前缀由-webkit-改为-moz-罢了.opera的反应比较呆滞,应该说私底下

Web实现音频、视频通信

Google开源实时通信项目WebRTC Google正式开源了WebRTC实时通信项目,希望浏览器厂商能够将该技术内建在浏览器中,从而使Web应用开发人员能够通过HTML标签和JavaScript API就实现Web音频.视频通信功能. WebRTC(Web Real Time Communication)并不是Google原来自己的技术.在2010年,Google以大约6820万美元收购了VoIP软件开发商Global IP Solutions公司,并因此获得了该公司拥有的WebRTC技术.

我的Android进阶之旅------&amp;gt;Android中编解码学习笔记

编解码学习笔记(一):基本概念 媒体业务是网络的主要业务之间.尤其移动互联网业务的兴起,在运营商和应用开发商中,媒体业务份量极重,其中媒体的编解码服务涉及需求分析.应用开发.释放license收费等等.最近因为项目的关系,需要理清媒体的codec,比较搞的是,在豆丁网上看运营商的规范 标准,同一运营商同样的业务在不同文档中不同的要求,而且有些要求就我看来应当是历史的延续,也就是现在已经很少采用了.所以豆丁上看不出所以然,从 wiki上查.中文的wiki信息量有限,很短,而wiki的英文内容内多,