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

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"                                          /,   _.. \   _\  ;`._ ,.                         `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 4 July 2003 07:52:09 UTC