- From: L. David Baron <dbaron@fas.harvard.edu>
- Date: Wed, 24 Oct 2001 19:59:22 -0400 (EDT)
- To: <www-style@w3.org>
On Wed, 24 Oct 2001, Jesse McCarthy wrote: > Here's my question: How is it possible to devise a system -- a second > generation system no less -- for laying out and specifying the > presentational aspects of HTML documents that is so feeble that it can > not even be used accomplish the most elementary goal of horizontally > and vertically centering a DIV containing some text within another > DIV? The basic problem here is that the CSS box model was designed based on well-known concepts of document layout. It is a very well-designed box model for documents. However, it was not designed for user-interface layout. The box model uses top-down (in the tree structure) width computation and bottom-up height computation and has almost no concept of bottom-up width computation or top-down height computation, which are critical for much user interface layout. A small reference to the first of those concepts has been added as a proposed change to CSS2 [1], but it have not yet been clearly defined and it is only used in very limited ways. A large percentage of the pages on the web are not documents in the conventional sense -- they are user interface, or sometimes user interface wrapping documents. CSS is a insufficient for describing user interface -- even more so than tables are, so tables are still common on the web and probably will stay that way as long as CSS doesn't have a better box model for describing user interface. CSS is being used more on the web, but its box model is not replacing tables in many places -- it's often being used within tables. The XUL box model [2] is an example of a simple constraint-based layout system with more bottom-up reflow based on preferred size, minimium size, and maximum size, and boxes lay out their children either horizontally or vertically. It takes a number of ideas from systems such as InterViews [3]. It is *much* easier to describe the presentation of a user interface using the XUL box model than it is using tables or using floats (which are even more of a hack than tables for describing user interface). This box model was sufficient for describing the user interface of Mozilla. It's not perfect -- there are some features that it probably should have, but doesn't, but it's much better for describing user interface than HTML (or CSS) tables or floats. In the future, I'd like to see CSS incorporate display types and properties to allow both types of box model. (I'd like to work on it if I can find the time to do so.) I believe they can be mixed -- there are some difficulties computing the minimum or preferred width of a box that contains floats, but those problems are no worse than those that already occur within tables (whose layout is based on the minimum and preferred widths of its children) and satisfactory compromise solutions exist that avoid causing ugly overflow. -David (speaking only for myself) [1] http://www.w3.org/Style/css2-updates/REC-CSS2-19980512-errata.html#s-10-3-7 [2] http://mozilla.org/xpfe/ and http://mozilla.org/projects/xul/ and particularly http://mozilla.org/xpfe/xptoolkit/boxes.html [3] http://www.vectaport.com/ivtools/interviews.html -- L. David Baron <URL: http://www.people.fas.harvard.edu/~dbaron/ >
Received on Wednesday, 24 October 2001 19:59:23 UTC