📜 ⬆️ ⬇️

Yesterday, CSS turned 20 years old. Interview with Haakon Wium Lee (Part 2)

Continued. The first part was published yesterday.




Why did you prefer the block model, in which indents, borders and margins are added to the specified width, rather than the box-sizing: border-box model from IE5?
')
There are suitable use cases for both models. If you want the image to stretch to fill the block - the original CSS model fits better. And if it is necessary that the fields and borders do not go beyond a certain area, the IE5 model is better. Personally, I think that there are more cases for which the standard CSS model is better suited, but some people whom I respect a lot think otherwise. This conflict was elegantly resolved by adding the box-sizing property, which all browsers now support.

I never liked absolute positioning. I am wrong? How did it appear in the specification?

Your question brings me back to 1996, when there was a heated debate about this. In a nutshell: Microsoft offered to introduce absolute positioning in the CSS Regions: Absolute Positioning and Z-Ordering draft (unfortunately, the discussion took place on the private W3C mailing list, here is the nearest publicly available document ). Some members of the recently formed CSS working group had doubts, and Bert and I wrote a simplified counter offer. In it, we offered to get rid of the position property (and use display instead) and described only relatively positioning (which gave us time to think thoroughly about absolute positioning). However, Microsoft has already implemented its own offer and did not want to remove this feature. In the end, the only significant changes were the addition of the right and bottom properties in addition to the left and top and position: fixed . As such, the specification has become part of the CSS2 standard .

Like you, I have never been pleased to work with absolute positioning. However, it has found its place in web development, and sometimes I use it to do something that is difficult or impossible to do otherwise.

Sometimes I have to hear that it’s wrong to use floating blocks for layout, since they are not “intended” for this purpose - they were only intended to set text wrap around the images. Does it matter if this layout method works well?

Text wrapping around pictures is one of the basic layout techniques, so floating blocks can certainly be used in it. One of the areas in which, in my opinion, the CSS standard should develop is paginated presentations . When your content is explicitly paginated, floating blocks become even more important as you can link them to the top and bottom of the page.

If you had a magic wand, which part of the CSS would you remove without a trace, and what would you do the opposite, add everywhere?

I would throw away any code tied to specific browser versions, like <!--[if lt IE 7 ]> . Although, strictly speaking, such "comments" are not part of CSS, they should not be used anywhere - they greatly lower the standards of the web.

The second part of your question is much more interesting. In 2006, I would add web fonts . In 2007 - the <video> element (if you allow yourself to briefly invade HTML territory). Now both of these features are supported by all browsers.

In 2011, seeing how many applications prefer to split content into pages, instead of using scrolling, I began to promote the idea that web pages should become real pages . The essence of the idea was that in styles it would be possible to turn on page mode in which the content of the document is divided into separate pages. They can be flipped through gestures or keys PageUp and PageDown. I want to make it easy to create book reading apps in the browser. That's what magic would do for me. You, by chance, do not have a little magic pollen to dispel it over the pillows of all browser manufacturers?

Why is there still no way to create a page that does not require two higher education? (I'm talking about you, flexbox ...)

Layout is a tricky business, and layout for the web is even more difficult, because pages must be displayed on multiple devices. CSS has several mechanisms for layout, including absolute positioning, floating blocks, multi-column layout and tables. Combining these mechanisms is not easy, but I do not think that this requires two higher educations. True, I must admit, I have not used flexbox too much.

How do you feel about preprocessors like SASS and LESS? CSS have a lot to learn from them?

Yes, preprocessors are useful stuff. I think we should take the heels of the most popular things from preprocessors and include them in the CSS. Personally, I really like nested selectors and single-line comments (which start with //). When CSS is 50 years old, I will tell you why they were not included in the standard from the very beginning.

You are one of the WHATWG members. How did you get there?

WHATWG was formed when it became clear that W3C was moving away from working on HTML and concentrating on XHTML, XForms, SMIL, and SVG-based composite documents . For browser manufacturers, HTML was too important to be abandoned like this. Therefore, Ian Hickson, who worked with me at Opera at the time, founded the WHATWG to continue working on the web as we knew it. In addition, we have the doubts of the Microsoft XAML , which was a thin layer of XML on top of the proprietary application language. Therefore, WHATWG focused on web applications, not documents. Jan continues to do a wonderful job as an editor for the HTML standard.

You are the father of CSS, and yet you recently published several specifications under the auspices of the WHATWG, and not the CSS working group of the W3C. Why?

Indeed, the WHATWG is currently working on standards for illustrations ( CSS figures ) and books ( CSS books ). The publication of standards in the WHATWG has several important advantages. The “living standard” model allows for quick updates with minimal overhead costs; in the past it was very difficult to publish W3C work drafts in this area. I warmly support the WHATWG in an effort to maintain the standards in such a state that they only slightly outpaced the current level of implementation, and did not go far ahead , so that the developers give up.

Last question: does CSS handle its tasks? Or maybe we should go to another model, for example, Grid Style Sheets ?

Ethan Munson and Philip M. Merden wrote in 1999 that "the languages ​​of the styles are very poorly researched." This statement is still true, and attempts to study and improve style languages ​​are welcome.

GSS is a very interesting example, its creators apply the Cassowary constraint satisfaction algorithm to the style sheet engine. In my initial CSS implementation, I used the SkyBlue algorithm to resolve conflicts between conflicting expressions. (By the way, both of these algorithms were developed at the University of Washington.) The algorithm for satisfying constraints allows us to express the relationship between arbitrary elements and automatically resolve conflicts. But everything becomes much more complicated when elements are constantly disappearing and being added, as is the case with DOM manipulation. You also need to be very careful with ring dependencies. Therefore, the idea of ​​allowing CSS to express the limitations of the layout between any elements had to be abandoned at an early stage of development.

In the past, in order to add support for the new standard, it was necessary to convince all browser developers to spend their precious time on it. This became a serious obstacle, perhaps even too much. These days, browser capabilities can be extended with JavaScript. It has become much easier to set up experiments and conduct research that style sheets have long deserved.

Coming back to your question: does CSS cope with its tasks? I think yes. I do not see anything in the foreseeable future that would make me think otherwise. New ideas emerge, but they expand CSS rather than replace. I believe that the CSS code that we write today will be understood by computers even after 500 years.

Thank. Happy birthday, CSS!

Source: https://habr.com/ru/post/240055/


All Articles