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

Bert Bos 如何参与进来的,你们怎么一起工作的?
How did Bert Bos get involved, and how did you work together?

伯特·波斯回顾我的初步建议。他的背景和重点是与我的有点不同,但是当他写了自己的建议,我们很快就意识到,这两项建议可以合并成一个。在这一点上,网络项目被踢出欧洲核子研究中心的出来,W3C 成立。我开始了 W3C 的 INRIA 欧洲分公司和 Bert 立即被录用。大多数 CSS1 被敲定在索菲亚 - 安提波利斯白板在1995年7月伯特仍然是工作的 W3C 在索菲亚 - 安提波利斯。每当我挣扎着困难的技术问题,我想伯特和白板在那里。
Bert Bos reviewed my initial proposal. His background and focus was a bit different from mine, but when he wrote up his own proposal we quickly realized that two proposals could be combined into one. At that point, the web project was being kicked out of CERN and W3C was formed. I was starting up the European branch of W3C at INRIA and Bert was hired immediately. Most of CSS1 was hammered out on a whiteboard in Sophia-Antipolis in July 1995. Bert is still working for W3C in Sophia-Antipolis. Whenever I’m struggling with a difficult technical problem, I wish Bert and the whiteboard were there.

在列出的人谁做的 CSS 可能,我还必须提到托马斯·里尔登和微软的克里斯·威尔逊。托马斯是项目经理的 Internet Explorer(IE)谁早抓上添加样式表来对网站的想法。克里斯·威尔逊是谁添加 CSS 来 IE3 的程序员。 IE3 的实施远没有标准,但是我们必须记住 CSS1 结束之前,它被释放。西蒙·丹尼尔斯(也是微软)写了一些令人印象深刻的演示中 IE3,和他们一起犯了一个主要的软件公司支持的新兴标准。
When listing people who made CSS possible, I must also mention Thomas Reardon and Chris Wilson of Microsoft. Thomas was the program manager for Internet Explorer (IE) who early caught onto the idea of adding style sheets to the web. Chris Wilson was the programmer who added CSS to IE3. IE3’s implementation was far from the standard, but one must remember that it was released before CSS1 was finished. Simon Daniels (also of Microsoft) wrote some impressive demos in IE3, and together they committed a major software company to support an emerging standard.

是否有竞争的其他草案,为何你的较优?
Were there any competing proposals? Why was yours better?

有要使用的十几个建议样式表语言。然而,并不是所有的人都适合的,因为在网络的特性。例如,浏览器使用渐进式渲染文件显示,他们必须处理,其中样式表无法访问的情况。有一个广泛的网络设备在那里,你不能写一个样式表的每一个。因此,样式表语言表达必须是可扩展性和响应性设计。这是研究的一个迷人的地方,我已经写了博士论文,其中比较所采取的各种样式表建议的方法。
There were a dozen or so proposals for style sheets languages to be used. However, not all of them were suitable due to the characteristics of the web. For example, browsers use progressive rendering to display documents, and they must handle situations where style sheets are not accessible. There’s a wide range of web devices out there and you can’t write a style sheet for each one. So, style sheet languages must express designs that are scalable and responsive. It’s a fascinating area of study and I’ve written a PhD Thesis, which compares the approach taken by the various style sheet proposals.

当然,我有偏见你问题的第二部分。但我相信,CSS 有几个显着的特点,这使得它特别适合于网络应用:级联,伪类和伪元素,向前兼容的解析规则,针对不同的媒体类型,十分注重选择,以及令人称奇的em单位的支持。
Naturally, I’m biased in the second part of your question. But I believe CSS has several notable features which makes it especially suitable for web use: cascading, pseudo-classes and pseudo-elements, forward-compatible parsing rules, support for different media types, strong emphasis on selectors, and the amazing em unit.

敢问,你和 Bert 出过最大的篓子是什么?
What’s the biggest mistake you (and Bert) made?

在我博士论文的主题,就是研究 CSS 的问题。有相当于问题是其自身的问题。但 CSS1 最大的问题不是设计问题(如果你问我设计好不好,我觉得还是不错的~哈哈),而是最初版本的实现,很糟糕。 Jeffrey Zeldman 这样说:
I devote a chapter in my PhD thesis to problems in CSS. There are some, even self-inflicted ones. But the biggest problem CSS1 experienced was not in its design (which is pretty good, if you ask me), but rather in the initial implementations. Jeffrey Zeldman described the situation:

If Netscape 3 ignored CSS rules applied to the element and added random amounts of whitespace to every structural element on your page, and if IE4 got right but bungled padding, what kind of CSS was safe to write? Some developers chose not to write CSS at all. Others wrote one style sheet to compensate for IE4’s flaws and a different style sheet to compensate for the blunders of Netscape 4.

这当然是微软和网景的责任(译注:属于实现的层面,不关我事哦),但是我、Bert、W3C在制定 CSS1 规范的时候,原本是可以通过测试套件来检测出许多问题的。话说第一款测试工具还是 1998年,为 Todd Fahrner 于 1998 年十月所推出,叫做 Acid。这是个神器,前所未有,让开发者看到结果到底是不是通过,而且还是可视化的。刚开始的时候,没有一款浏览器可以通过。及后,CSS 社区强力发劲,推动了 CSS 发展。WaSP 对标准的坚定支持亦是关键的一步。同时 Opera 在正确编写 CSS 实现方面也扮演了其重要的角色。当我知道 Oprea 对 CSS 实现的态度是如何坚定的时候,便促使我投奔向 Oprea 公司,而非什么微软或网景。
Microsoft and Netscape both deserve some blame, but we — me, Bert, W3C — could have avoided many problems by producing a test suite along with the CSS1 specification. The first real CSS test appeared in October 1998 when Todd Fahrner published his Acid test. The test was creative, visual, and developers could immediately see whether they passed the test or not. In the beginning, no browsers passed. But then, with a strong push from the CSS community, things started to improve. The WaSP played a key role in assuring support for standards. The Opera browser also played a role by showing it was actually possible to implement CSS correctly. When I realized how solid Opera’s CSS implementation was — much better than Microsoft’s or Netscape’s — I joined Opera.

在我加入之前,Opera 曾标榜其体积极小,一张软盘就搞定了(1.44MB),这是当其时的一个亮点。不过~哈哈,加入 CSS 之后,越来越大了,一张软盘哪搞得定呀~
One of Opera’s claims to fame before I joined was that the browser would fit on a floppy disk (which is 1.44 MB). “Fits on a floppy” was a great slogan in those days. When CSS was added, a few more bytes were needed and Opera would no longer fit. “Almost fits on a floppy” doesn’t quite have the same ring to it.

Acid 的后续有 Acid2 和 Acid3,但都是同一条准则,即对 Web 页面进行多项严格的测试。后来,Bill Gates 看到问题所在,也按捺不住了,发表一封公开信。该公开信得到了 Acid2 开发团队的响应。总之,这使得 IE7 开始兼容标准,当然仍是很多问题。不过公道地讲,其他浏览器也有问题,通通都给 Acid2 暴露出来了。微软对 IE7 在 Acid2 的表现糟糕,干脆不理——到 IE8 的时候却跟上来了,完全通过!同期的其他浏览器也没啥问题了。
The original Acid test inspired Acid2 and Acid3, which use the same formula: a visual and demanding web page which tests a wide range of features. The development of Acid2 was triggered by an open letter from Bill Gates, where he praised interoperability. Making IE7 follow the CSS standards seemed like a natural follow-up item, and Microsoft was challenged by Acid2. In fairness, other browsers also had issues, and Acid2 exposed bugs in all of them. Microsoft ignored Acid2 in IE7, but — magic sometimes happens — IE8 supported it perfectly. As do all current browsers.

你为什么决定包装盒上的模式,即的margin,padding,边框都加入到申报的宽度,而不是IE5箱大小:边界盒模型?
Why did you decide on the box model whereby margin, padding, border are added to declared width rather than the IE5 box-sizing: border-box model?

有良好的用例两款车型,我相信。如果你想要的图像伸出来填充整个内容中,原来的 CSS 框模型是一个使用。但是,如果它是填充和边框并不一定区域之外的延伸是重要的,在IE5的模型更好。我个人认为还有更多的用例的 CSS 框模型,但有些人说我尊重看得起并非如此。冲突已经通过加入其中所有的浏览器都支持的盒集束性的正常解析。
There are good use cases for both models, I believe. If you want want an image to stretch out to fill the whole content box, the original CSS box model is the one to use. However, if it’s important that padding and borders do not extend outside a certain area, the IE5 model is better. Personally I think there are more use cases for the CSS box model, but some people that I respect highly think otherwise. The conflict has been gracefully resolved by the addition of the box-sizing property which all browsers now support.

我本人不太喜欢绝对布局。是我理解有问题吗?它是怎么来到规范中的?
I’ve always disliked absolute positioning. Am I wrong? How did it come about in the spec?

你的问题令我回忆 1996 年时候大家争得面红耳赤。简单说,就是那时候微软提出了一份草案,那时候还不叫绝对布局,说是 CSS Regions:里面有绝对布局和 Z-Ordering。仅限 W3C 会员的讨论,我猜。这是刚组建不久的 CSS 工作组。对此,里面几个成员均有所保留。于是我和 Bert 撰写了一份简单的反对草案,在这个草案中移除掉定位属性 position property(取而代之的是 display 属性)。最后,微软也移除了他们在草案中已经实现了的功能。作为妥协,加入了 right /bottom 属性(相对于 left/top属性),还加入了 position:fixed。这都成为 CSS2 的一部分。
Your question takes me back to some heated debates in 1996. The short story is that Microsoft proposed absolute positioning in a draft called CSS Regions: Absolute Positioning and Z-Ordering (discussions took place on W3C member-only lists, I’m afraid; the closest public document is WD-positioning). Several members of the newly formed CSS Working group had reservations, and Bert and I wrote up a simplified counter-proposal. Our proposal got rid of the position property (display was used instead) and only described relative positioning (which would give us time to think through absolute positioning). Microsoft, however, had already implemented their proposal and were reluctant to remove functionality. In the end, the only material changes were to add the right and bottom properties (to balance left and top), and to add position: fixed. This became part of CSS2.

我和你身同感受,不怎么感冒绝对布局。不过话虽这么说,绝对布局找到了它自己合适发挥的地方,我不时用它来实现的某些东西,不用的话将会很困难,否则就要进行硬编码。
Like you, I have never become comfortable with absolute positioning. That being said, absolute positioning has found its place on the web and I use it from time to time to achieve things that would otherwise be hard, if not impossible, to encode.

我有听人说过,不要采用浮动布局,就像他们“不想”在文字围绕图片中使用浮动。不过,如果可行,这种想法重要吗?
I’ve heard people say that you shouldn’t use floats for layout, as they “weren’t intended” for that — they were just to wrap text around images. Does the intention matter, if they work?

文字围绕图片是个简单的活。这种情况肯定使用浮动布局。另外我希望在屏幕分页的时候也把浮动派上用场。因为你可以轻易地把页码标记作为浮动元素标记在屏幕的任意一个地方,如左上或左下。
Having text wrap around images is one of the basic layout techniques. For sure, floats should be used for layout. One area I’d like for CSS to progress into is paginated onscreen presentations. When you paginate content, floats become even more useful because you can float elements to the top and bottom of the screen.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值