Overhauling Style Sheets

In BradyBunchGridDiscussion, a possible approach to replace style-sheets was hinted at. Here's an adjusted snippet:

 <attribset name="atr">
   <attrib name="autorefresh" value="yes"/>
   <attrib name="width"  value=200/>
   <attrib name="height" value=200/>
   <attrib name="float"  value="left"/>
   <attrib name="autoscroll" value="yes"/>
   <attrib name="border" value=1>
 </attribset>
 ...
 <div>  <!-- row 1 -->
   <framediv attribs="atr" interval=2.5 src="panel.php?x=1&y=1"/>
 </div>
 <div>  <!-- row 2 -->
   <framediv attribs="atr" interval=4.0 src="panel.php?x=1&y=2"/>
 </div>

GuiMarkupProposal "Templating" offers another syntax possibility that is more compact:

 <template name="tp01" autorefresh="yes" width=200 height=200 float="left" autoscroll="yes" border=1>
 ...
 <div>  <!-- row 1 -->
   <framediv refTemplate="tp01" interval=2.5 src="panel.php?x=1&y=1"/>
 </div>
 <div>  <!-- row 2 -->
   <framediv refTemplate="tp01" interval=4.0 src="panel.php?x=1&y=2"/>
 </div>

Not sure I like the name "refTemplate", but this is just an illustration. And we could have a hierarchy such as "refTemplate='tp01,tp02,tp03'".

Basically, the idea that style-sheets are a separate "kind" of thing different from markup is tossed. The "inheritance" mechanism used for the markup (a GUI markup language in that case) could just as well be used for style-oriented elements. Thus, we don't have to reinvent the wheel twice for markup inheritance and style inheritance. (The borderline between what is semantic and what is "style" is blurry anyhow.)

An improvement can be made by allowing multiple inheritance, similar to what the existing HTML "class" attribute can already do:

   <sampleTag attribs="atr,atr2,atr3"  etc="etc"/>
The first attribute set ("atr" in this case) receives priority if there is an overlap in attributes. (The HTML Class attribute uses spaces to separate class names. Commas are more readable in my opinion. But the specific syntax is not important at this point until somebody goes to implement it.

[What makes this better than CSS? It seems to be it'll just encourage mixing of markup and presentation, the avoidance of which is a major reason why stylesheets exist. -DavidMcLean?]

The distinction is blurry in practice. This doesn't force mixing anyhow. And even if we do "separate" them, there's no reason to have them each in a different language.

The distinction is only "blurry in practice" if you have failed to distinguish content (what is to be presented) from presentation style (how it is to be presented). Whilst it is certainly possible for CSS to have been implemented using XML, it would have been overkill, because CSS is strictly about setting values of properties.

One can force a distinction, but often it's an arbitrary line in the sand. The customer says "make the page look like this", and they don't necessarily categorize what is what; they just want thing X in spot Y because they do and they call the shots. It's like yard landscaping: you can make recommendations and suggestions, but the house owner ultimately decides where stuff goes and how it looks. I cannot and am not paid to read their mind and so cannot classify their thinking into some idealistic categories. PrematureAbstraction. (Perhaps complicated by a central "style cop" versus a department user with a sub-site.) And XML is perfectly capable of setting values on properties. If we want to classify by tag or attribute name for some unstated reason, we can have parsers that do that. I'm not sure what practical problem you are solving by treating them as very distinct things and using different languages for each.

It is not "an arbitrary line in the sand", unless you do not understand the distinction. HTML is a markup language. CSS is a property-setting language. Both are minimal syntax sufficient to implement their respective semantics.

You haven't said anything concrete or distinguishing.

Actually, I have. Your apparent lack of recognition of this is telling. Do you understand the distinction between content and presentation? Do you understand the difference between a markup language and a property-setting language?

Let's look at something more concrete. Let's say we have a web page with one and only one little "panel" that the "customer" has asked to float to the right in the middle of the page with a picture and a little table of statistics. Whether floating to the right is semantics or a presentation style can be argued either way. It's the method chosen by the customer to present their idea/content. Presentation is communication (or at least can be). Whether the presentation contributes to communication of the idea or is "mere decoration" is difficult to pin down, especially for marketing-oriented stuff. And it's probably a philosophical question beyond the worth of having a developer/designer get overly concerned about. If the customer wants X red, make the damned thing red. It's a wasteful thing to obsess on the classification of the "red-ativity".

Second, it doesn't make much sense to use one language for describe it as a DIV or a unit and another for location info. Why the hell toggle between languages? I see no logic or rational. Doing it to "remind developer about separation" is weak, per above.

The partitioning should be based on estimated likely ChangePatterns, not some goofy arbitrary philosophical distinction. Misguided idealism f8cked up the current practice and the CSS designers should be slapped with a large wet curly brace.

[It's not arbitrary nor philosophical. Content and presentation are (quite obviously, really) different things. On the Web, content lives in HTML, and presentation lives in CSS. Both languages, as noted above, are the minimum syntax necessary to specify their respective semantics. Because presentation information does not require arbitrarily-nested markup, as HTML content does, CSS does not need to support those features; all it must do is associate properties with selectors, and it uses a simple yet effective syntax well-geared toward specifying the required selectors and properties. XML doesn't afford the same capability, because it's a way to encode trees, and CSS doesn't constitute a tree. -DavidMcLean?]

CSS should allow for tree-ness (and can indirectly using class lists and other tricks). Defaults/inheritance can apply to styles also and we don't want to repeat or micromanage each element styling if possible. For example, we may want to make a special "error style" for some elements to highlight errors, but not all. If there is an error, we may want to put a red box around DIV's and buttons but not SPAN's (or vise verse). Thus, we want the SPAN style to default to a wider category if not explicitly overridden by error-centric CSS. Ideally we could address a general area or DIV as being under the "error" mode and elements designated to recognize error-ness style themselves differently than the default style, if given an error-style.

If the distinction between content and presentation is truly clear, I invite you to write the algorithm/steps in a clear way. Otherwise, I remember skeptical and so should readers.

Further, it's illogical to have one default/inheritance technique for the markup and another different one for the styles. It should be uniform if possible so that one doesn't have to learn and remember two different ways to manage defaults/inheritance.

[CSS has inheritance. Specifically, it cascades; that's what the C stands for. HTML, by contrast, does not have inheritance. What would that even imply? -DavidMcLean?]

A more powerful GUI markup language will best be served with some form of inheritance and/or templating. HTML is crippled in that regard, and is thus sometimes enhanced with SSI's, ColdFusion, and other techniques.

[Ah, okay, that does make sense. It's less "inheritance" you're finding HTML lacks and more the ability to define custom "subroutines", I think. Generally that's addressed through application of server-side development, though, as you've noted: Most every view layer has support for partials that effectively extend the markup language with app-specific constructs. -DavidMcLean?]

No, subroutines don't handle things like attribute inheritance well. We don't want entire tag versus none.

Attribute inheritance is handled through CSS, which is precisely what it's for.

But we would want that ability for markup also. For example, rather than type a repetitious "onClick" handler for each list item, we can have it inherit that attribute, yet override it for specific items.

You mean an onClick that always invokes the same handler?

It doesn't have to be the same for every list item. But let's take the scenario that a large sub-set of the list will invoke the same handler.

In that case, some mechanism for declaring and using re-usable HTML blocks would be reasonable. However, server-side includes and server-side scripting in general obviate the need for this.

But the idea is to make common GUI behavior declarative. And SSI's don't handle attribute-level templating very well.

Yes, then server-side scripting is appropriate.

Then we have a different UI languages for each diff app language. That's like having a different DB query language for every different app language. I don't see that as a good thing.

Actually, it's like having SQL for querying and C# for application programming.

SQL is a far more powerful database language than HTML is a GUI language. What we need is The Sql of GUI's. (Ideally the SmeQl of GUI's, but I'll accept SQL for now.)

[HTML isn't a GUI language. It's a markup language. The HtmlStack, however, could be viewed as a GUI language that happens to have intrinsic SeparationOfConcerns. -DavidMcLean?]

Yes, that's why HTML is limited. Having different languages for SOC is silly, partly because the boundaries of concerns are fuzzy, and partly because concerns are interweaving as to not be linearly partition-able without sacrificing another concern. If each language did it's job far better than the other, you may have a case for having different languages, but such has not been shown.

Having different languages for SeparationOfConcerns minimises the extraneous syntax needed for each, and there are no fuzzy boundaries of concern in the Web client stack. The only thing "fuzzy" is your understanding of it.

So you claim.

Anyway, this debate is moot. You're not going to change Web standards by yourself.

I'm hoping to remind somebody of influence about the illogical convoluted TowerOfBabble? the HtmlStack has become. At least they should ask for "community comment" before building a new contraption to make sure they address design decision questions.

[You're not the only one who isn't particularly fond of the HtmlStack, but most solve it by substituting a different HtmlStack. In the RubyOnRails world, HTML/CSS/JavaScript is often replaced with Haml/Sass/CoffeeScript, for example; Jade/Stylus/CoffeeScript is popular in NodeJs land. No one but you finds the separation of content markup, presentation, and behaviour into separate languages a big enough problem to replace all three languages with one (most don't find it a problem at all). -DavidMcLean?]


More Semantics versus Presentation Fuzz

An example of a fuzzy boundary could be "kinds of ads" a company shows on its web pages. The "kind" may be defined by how they look, or what kind of content is present, or who "invented" the look or style or layout, or a combination. The "meaning" of their classifications may be very nebulous. The "types" may be just names given in an attempt to label a nebulus concept or set of concepts because a fuzzy name may be slightly better than no name, but is otherwise hard to pin down and may not be pin-down-able. Forced classification can be PrematureAbstraction. Such domain abstractions often change in an organic and unpredictable way.

We have pre-defined historical conventions in text such as "paragraph", "block quote", etc., but domain-specific things don't necessarily have a reliable history. And the semantics versus presentation-ness is hokey even in the established ones. A numbered list could be considered a presentation choice versus a bulleted list, for example. Even the concept of a "table" can be fuzzy. The choice to present a physical grid versus the following is also a presentation choice:

  Emp ID: 35
  Name: Fred P. Jones
  IQ: 68
  Hire Date: 12/12/2000
  ---------
  Emp ID: 36
  Name: Lisa J. Mac
  IQ: 212
  Hire Date: 01/14/2006
  ----------
  Emp ID: 37
  Name: Flippy J. Offy
  IQ: 89
  Hire Date: 09/02/1998

dBASE used to allow toggling between a traditional grid table and the "verticle row" style above, by the way.

Perhaps HTML should have one tag, the TAG tag, which specifies the nesting relationship only. Everything else is "presentation". Whether you want to read a list as a list or a single-column table or a comma-separated item paragraph is purely a display choice: do you want your pea soup in a bowl or in a cup or on your enemy's lap? It facilitates universal customization. You don't have to settle for BLOCKQUOTE, but you can have different kinds of blockq-uotes, such as one color/style for quotations from the good guy and another color/style for the bad guy: GOODYQUOTE, BADDYQUOTE. Why have one syntax for standardized text elements (P, BLOCKQUOTE, etc.) and something different for non-standardized domain-specific or stupid-wishy-washy-customer-specific ones? Reserve label names, fine, but don't force a different syntax between built-in and non-built-in textual abstractions.

Thank You for this opportunity to rant my ass off. You may not agree, but I hope it gets the design philosophy gears rolling in your head. --top


Perhaps a compromise could be a local default style that is overridden by a "master style" set when available. This gives us a "self-contained thing", but also allows adapting to local customs (a shared sheet) if and when available. For example, the default font for all headings could be Arial when there is no master style sheet or if it's not ready yet.

[Already possible:]

  <style type="text/css">
    /* local styles go here */
  </style>
  <link type="text/css" src="style/master.css" />

[They're called cascading style sheets for a reason, y'know. -DavidMcLean?]

That's backwards from the priority that's needed, I believe.

[Nope, that's right. The problem statement calls for a "local default style overridden by a 'master style' set when available", and later CSS always overrides earlier (well, subject to specificity and !important and such), so the local styles belong before the master stylesheet. -DavidMcLean?]

Some browsers don't work that way if I remember correctly. I'll have to run some tests on some older versions and get back to you.

Broken old browsers seem rather irrelevant. If broken old browsers don't properly support standard style sheets, they're certainly not going to retroactively support an "overhauled" style sheet.

I'm talking about app designer schedules, not desktop updater schedules.

??? What does that mean, exactly?


CategoryWebDesign


AprilThirteen


EditText of this page (last edited February 2, 2014) or FindPage with title or text search