W3C home > Mailing lists > Public > www-style@w3.org > July 2003

Re: "display: image;" for CSS styling of images embedded in XML documents?

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 4 Jul 2003 04:52:28 -0700 (PDT)
To: James Craig <work@cookiecrook.com>
Cc: David Woolley <david@djwhome.demon.co.uk>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <Pine.LNX.4.56.0307040443150.9100@dhalsim.dreamhost.com>

On Thu, 3 Jul 2003, James Craig wrote:
>
> However, a :broken pseudo-class would be useful in styling an element
> different ways depending on whether or not the generated content is
> displayed. For example, I may want a width or border specified on the
> actual image, but not on it's text equivalent.

This requirement was originally on my list, but I had to drop it because I
couldn't work out any sane way to do it.

You can't use a pseudo-class, because that makes the cascade dependent on
the layout, which is a definite no-no.

You could use comma separated values for some properties, e.g. width,
height, overflow, margin:

   content:  url(movie), url(photo), url(flash), url(text), contents;
   width:    100%,       auto,       100%,       10em,      auto;
   height:   auto,       auto,       100%,       5em,       auto;
   overflow: hidden,     visible,    auto,       scroll,    visible;
   margin:   0,          0 auto,     0 auto,     1em 0,     0;

...but then you run into problems with properties that already use all the
different separators, such as 'font', and anyway the whole thing makes a
joke of the cascade (imagine all that cascading with another stylesheet
that had a slightly different order for the 'content' value).

You could try to come up with some hair-brained @-rule to solve this and
all other co-dependent property problems, but I have yet to see a workable
solution (if I ever see one, I'll run with it!).

This is not a trivial problem. My answer, at the moment, is "an element
has its own set of properties regardless of its contents". If you really
want to do something like the set of properties above, you might be able
to do it by using something scary like depending on nested :before pseudos
not being rendered if their pseudo-parent (hmm, I could get used to that
term) is a replaced element, and then carefully overlapping any styles of
the parent in the child, or something. I wouldn't like to write _that_
stylesheet though.

-- 
Ian Hickson                                      )\._.,--....,'``.    fL
"meow"                                          /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 4 July 2003 07:52:09 GMT

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