Re: What about styling anonymous container boxes?

Ian Hickson wrote:
> 
> Imagine you have a box - say, an H1 - and you want it to have two
> borders, one dark blue and one light blue.
> 
> If you have access to the document source, then you can do this quite
> easily: [... but that is a bad idea ...]

>
> I suggest the introduction of a pseudo-element that inserts an
> anonymous box around the principal box of element in question. This
> would then allow for the type of styling described above.

That would deal with that one example. It adds complexity at the expense
of not really adding a great deal of functionality. It doesn't deal with
the case where I want the inner border tight around the text but the
outer border right out to the margins. It doesn't deal with the case
where I want trhe outer border around a complete definition in a
definition list - around each <dt> and any associated <dd>s - zero or
more, depending on the document

Your example is one simpole instance of the general case where the input
document does not have the structure that is wished for the styled
document.

This is where a separate transformations step, specified as part of the
style sheet processing, is beneficial. The transformation part of XSL,
outputting another XML document with the correct structure for CSS
styling, seems to be an appropriate tool.

Then, you get the best of both worlds: the source document is left
alone, but the required CSS is much simpler because the styled document
has the right structure and your double border example is readily
handled by any CSS1 implementation.

It also reduces to a null set the number of extra issues which arise
from your alternative proposal.

Received on Tuesday, 9 February 1999 21:05:42 UTC