RE: Display Property Suggestion

On Fri, 30 Oct 1998, Gabriel Paiz III wrote:
>> The display property should be extended to also take a url() in
>> conjunction with one of the keywords, thus:
>> 
>>   [ inline | block | list-item | run-in | compact | 
>>     marker | table | inline-table | table-row-group |
>>     table-header-group | table-footer-group | table-row |
>>     table-column-group | table-column | table-cell |
>>     table-caption ] <uri>? | none | inherit
>> 
> Can <uri>? be replaced with:
>  [[<uri>, ]*  [missing | <some other defaults> | none]]?
> to handle MIA replaced content?
The multiple <uri> seems like a good idea, certainly. I think the
"missing" keyword is a bit redundant, since it prevents the
alternative content from being drawn. Better would be to put the
"missing" picture into the final content property (see last example
below).

BTW, an advantage of multiple <uri>s is that this is possible:

 img:before { display: inline url(attr(src) ".png") url(attr(src) ".gif")
              url(attr(src).jpg); width: auto; height: auto; }

...or at least, it would be if the url() notation took both the attr()
notation _and_ some extra text! Of course, server-based content
negotiation is better for this purpose.

> As a side effect, developers could implement their own custom
> 'broken image', 'broken object' icons.
I think it is more important for browsers to degrade gracefully down
through the possible content types, in a worst-case-scenario using the
replacement text, than it is for them to have fancy MIA icons.

i.e., the replacement icon is never needed, since if the content is
MIA or unusable by the UA, then the alternative text is used.

>> This can actually cope with the IMG element too:
>> 
>>    img:before { display: inline url(attr(src)); content: attr(alt); 
>>                 width: auto; height: auto; }
>> 
> The above would become:
> 
>     img:before { display: inline url(attr(src)), url("mia.png"),
>                  missing; content: attr(alt); width: auto; height: auto; }
> 
Again, the "mia.png" file and the "missing" keyword are never needed,
since a better replacement to attr(src) if attr(src) is unavailable is
attr(alt). In the above case, the alternative text would _never_ be
used.

Of course, if there is no content to display at all, i.e., the element
is empty in the case of a real element or the content property is ""
in the case of a pseudo-element, then the UA could default to an MIA
icon. Again, though, it would IMHO be better if the UA just didn't
display anything at all -- i.e., treated the next two identically:

 IMG { display: block url(deadfile); content: ''; }
 IMG { display: none; }

Alternatively:

 img:before { display: inline url(attr(src)); content: url("mia.png");
              width: auto; height: auto; }
 img[alt]:before { display: inline url(attr(src)); content: attr(alt);
                   width: auto; height: auto; }

...would do what you describe.

-- 
Ian Hickson

Received on Friday, 30 October 1998 15:37:47 UTC