메아리 저널

Cascading Style Sheets and Declarative Languages​

The most bright choice made by creators of CSS is, that it is declarative. Well, it turns out to have some other problems as well but it’s a lot easier and saner than XSL. That’s because it is not a full-fledged language: you don’t know how the page is rendered1 in the core of web browsers, but still you can make a reasonable design in CSS!

Declarative languages like CSS and SQL are very useful if imperative approach is cumbersome and intractable. The downside of declarative approach is, of course, that you cannot guarantee the exact behavior in general, and that you normally have to rely on the particular implementation (like web browsers and RDBMS engines). SQL does have this problem — sometimes you need to “tune” SQLs to meet the performance criteria, and end up with (often proprietary) hints for the particular engine. But CSS is much simpler than SQL and mostly free of such problems, so it is a wise choice for CSS to remain declarative. That’s why I was sharply critical of CSS transitions and animations: first of all, do you really want to code an animation in CSS?!


  1. It may seems easy at first glance, but it becomes quite hard to get right and still be efficient if you use float property. That said, Mozilla once had “reflow” branch to correct such problems and spent years to merge back to the trunk, thus passing Acid2 test. Kudos to all web browser teams. 


노트들

  1. arachneng posted this
텀블러를 씁니다.