Re: content: url() is bad

On Wed, 14 Apr 2004 staffan.mahlen@comhem.se wrote:
> On 14 Apr 2004 at 14:00, Ian Hickson wrote:
>> On Wed, 14 Apr 2004 staffan.mahlen@comhem.se wrote:
>>>>
>>>>    http://ln.hixie.ch/?start=1075242104&count=1
>>>>    http://ln.hixie.ch/?start=1081717954&count=1
>>>
>>> In both those cases using the object element seems more appropriate?
>>
>> Why? The two are basically equivalent.
>
> How do you make:
> <img src="..">
> 	<table>...
> </img>
>
> work? Thats a rather fundamental difference to me. I saw your alt-
> descriptions as elaborate enough to warrant the object, while i see img
> as more for the trivial stuff. Your entities might for instance have
> worked better as markup?

This seems like quibbling. The images in the cases above have just plain
text as replacement text. <img> handles that.

<object> would too but that is rather inconsequential.


>> If you have:
>>
>>    ...
>>    h2#news { content: url(news.png); }
>>    ...
>>    h2#navigation { content: url(N) "avigation"; }
>>    ...
>>    h2 { border: solid; }
>>
>> ...then admittedly the borders on:
>>
>>    <h2 id="news">News</h2>
>>    <h2 id="navigation">Navigation</h2>
>>
>> ...will look different, but isn't it going to be reasonably obvious that
>> the problem is that one just has an image and one has more than an image?
>
> No i am afraid that this is non-obvious IMHO. Its a very rare case
> indeed, so not a major issue, but each such addition adds to the
> complexity of CSS.

And pseudo-elements don't? :-)


>>> IMVHO this is where CSS oversteps its boundries, and mixes layers.
>>
>> You mean as apposed to:
>>
>>    head { display: block; }
>>    style, script { display: table-cell; }
>>    body { display: none; }
>>
>> ...?
>
> That's a nice point :), but those are not "messing" with the document
> tree or style/semantics distinction, they just create one possible view
> of the data. Other options might be 'white-space: pre' or that content
> special-cases the Unicode code point "\A".

   h1, p, div { display: inline; }
   sub { display: block; vertical-align: baseline; font-size: 1em; }
   strong { display: none; }

Those are a lot worse than:

   abbr { content: attr(title); }

I'm not denying that 'content' can be abused. In fact I don't really even
deny that it can be abused more than anything else so far:

   http://markschenk.com/cssexp/contentnstyle/index.html

...but I don't think that is a reason not to do it, or to make it harder
to use in the typical cases (even if that does make some edge cases
harder to debug).


>> It's not a document fragment, it's just a list of CSS boxes, like in
>> CSS2. There is no nesting allowed, no formatting allowed. It's just a
>> list of text strings mixed in with replaced elements.
>
> Was "replaced elements" a typo?

No.

> Thats probably where i would like to refer to the markup language since
> that suggests semantics to me. I am not quite as sure where to draw the
> line as the person who started this thread however.

Take the following GameML (based on the kind of thing you could imagine
could be used in an XML version of voidwars.com):

   <planet>
    <metal amount="23 megatonnes" accessible="accessible"/>
    <wood amount="12 megatonnes"/>
    <stone amount="228 megatones"/>
   </planet>

...with CSS:

   planet { display: block; }
   planet > * { display: list-item; padding: 0 0 0 2em; }
   planet > metal {
      content: "Material: " url(metal) " Mass: " attr(amount);
   }
   planet > wood {
      content: "Material: " url(wood)  " Mass: " attr(amount);
   }
   planet > stone {
      content: "Material: " url(stone) " Mass: " attr(amount);
   }
   planet > :not([accessible])::after { content: " (Inaccessible)"; }

The semantics are all in the markup language. Why is this not legitimate
use of CSS?

-- 
Ian Hickson                                      )\._.,--....,'``.    fL
U+1047E                                         /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'

Received on Wednesday, 14 April 2004 12:59:55 UTC