W3C home > Mailing lists > Public > www-style@w3.org > November 1998

Re: Display Property Suggestion

From: Christian Kaufhold <chka@uni-bremen.de>
Date: Mon, 2 Nov 1998 15:30:01 +0100
Message-ID: <007901be066d$5c8255c0$37066686@standard>
To: "Ian Hickson" <py8ieh=www-style@bath.ac.uk>
Cc: <www-style@w3.org>
[I hope I formatted this a little better, sorry]
Ian Hickson wrote:
[...]
>Well, to start with, if you allow text first, as your suggestion does,
>then it allows for the content value " attr(alt), uri(xyz) ", which
>would be pointless (the uri would *never* be shown) while still being
>valid.
Well, it would be stupid for the author to write it, won't it?
You can also write: font-family: serif, sans-serif, monospace, cursive,
fantasy, "Times New Roman", serif.
and "Times New Roman" will never be used.

>> For example consider the following
>> XML fragment which uses an XML link to cite some other author (or is
>> it too far-fetched?):
>>   <headline>Mr. Miller says to this topic:</headline> <quote
>>   xml:link="simple" inline="true" show="embed" actuate="auto"
>>   href="http://www.whatever.com/article.xml#special"/>
>> Now quotes could be inserted even though it is a replaced element:
>>   quote[show=embed][actuate=auto] { display:block;
>>   content:open-quote url(attr(href)) close-quote, attr(href) }
>> (The attr(href) is added as a backup if the resource is not
>> available, so that you user can the uri at least.)
>This is *not* replaced content, though, it is flowing the document in.
>
>It is the same difference as between SSI and IFRAME inclusions. One is
>flowed in, the other has it's own box.

But even the own box of an IMG element had to be floated in if we said:
IMG:before { content:"Image start "; }
IMG:after { content:" That was the image" }
or should the :before and :after pseudo-elements automatically be set to
"block" on a replaced element?

>I really cannot see how you would define the rendering of *replaced
>content*, which is what we are doing here, while still allowing
>*multiple uris* and *text*!
>
>Seriously: how would you render the following?
>
>   IMG  { display: block; content: "Hello" uri(hello.gif) "World"
>          url(world.gif), auto; border: thin solid black; }
>          /* the gifs are very different sizes */
>
>AFAICT, currently 'content' works by *flowing in* the text, with
>inline replaced elements as part of the flow. This *prevents you* from
>accessing the replaced elements directly.
>
>For example, how would you resize the graphic in the following:
>
>   IMG  { content: uri(hello.gif), auto; }
>
>using your system? You can't set the width/height, because that would
>have the same effect as it does now on before/after -- just setting
>the size of the container, presumably cropping the image. Imagine:
>
>   IMG  { content: uri(hello.gif) " the " uri(world.gif); }
>
>How do you resize the replaced elements now?

We would have to add to the definition of width and height that if they
are used with replaced content, they resize the element. Or maybe a
keyword "resize" could be added to the overflow property for replaced
elements.
Actually setting width/height has the problem that if you offer multiple
uris, they might not all have the same size (maybe width/height should
also take multiple values, in the same order as content).

>This is why I really do suggest only allowing uris, and only single
>uris, in the first part. We are *only* referring to replaced content,
>here, not generated (flowed in) content. *That* we can already do, by
>using the last part of the content property.

But this only allows one chance for flowed-in content, but several for
replaced content. I think if we want (or have to) distinguish between
these two, we also have to allow multiple possibilites for flowed-in
content.
Maybe like this:
content:

  [ [ replaced( <uri> [ "," <uri> ]* "," ) ] ?
  [ [ <string> | <uri> | <counter> | attr(X) | open-quote |
    close-quote | no-open-quote | no-close-quote ]+ "," ]* | auto ]
    | inherit

with the recommendation that the last flowed-in content should not
contain an uri.
That would make:

* { content: auto; }
IMG { content: replaced(uri(attr(src))), attr(alt); }
OBJECT { content: replaced(uri(attr(data))), auto; }
IFRAME { content: replaced(uri(attr(src)), uri(attr(longdesc))), auto; }

A[HREFLANG|="de"]:before { display:inline; content: uri(german.gif), "in
German: "; } /* an example of multiple flowed-in content */

And now we still have to think about
a) if it should be allowed for :before and :after elements to contain
replaced content (I think not).
b) if content for the element itself should really take quotes and
counters (I am still not convinced of that, and it only complicates
things - I think they can also be set with :before and :after).

>> I would suggest that the last value for content must _not_ contain
>> an uri (like the last value for font-family has to be a generic
>> font-family and the last value for cursor a generic cursor), even if
>> this is "" or auto (which would mean "" with empty elements).
>That would break backwards compatability with CSS2.
But it would not do any harm (if there actually a style sheet existed
that used it that way). Or we could say the renderer should assume ""
(or display an error message) if even the last option contains an uri
and it can't be accessed.

Christian Kaufhold
Received on Monday, 2 November 1998 09:32:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:56 GMT