Re: Style rules to emulate HR

At 2001-02-19T00:05-0000, ValerieGSharp wrote:-

> Isn't the use of 'display:block' and 'br:before{content:"\A"}' something
> of a tautology?
>
> After all, block boxes are laid out one after the other, vertically -
> i.e. each starting on a new line, so to speak.

I think it's worse than a tautology: you would get an anonymous block box
before the BR, then the BR block box including a line feed, then another
anonymous block box after the BR. This would result in a blank line,
rather than just the intended line break.

> One could use 'display:inline' with the 'br:before{content:"\A"}'
> pseudo-element - perhaps this would be more in keeping with the concept
> of <br>.

This would in principle work, but for:-

> However, if this is a default stylesheet, then if an author were to
> subsequently define a different 'br:before...' pseudo-element, then the
> "essence" of the br would be lost - so maybe 'display:block' is the
> better solution?

Yes. Unfortunately, there is no way to add to generated content; it can
only be overriden. (For it to be otherwise seems not really to be in the
spirit of the cascading rules.) Given this, display:block seems a little
better, in that it allows generated content without simultaneously
possibly altering the behaviour. CSS3, I believe, will allow
'br { display: inline; content: "\A" }', which seems to combine the best
of both approaches.

> Also, from CSS2 12.2 The 'content' property: 'Authors may include
> newlines in the generated content by writing the "\A" escape sequence in
> one of the strings after the 'content' property. This inserts a forced
> line break, similar to the BR element in HTML.'
>
> Thus, "\A" should not be treated as collapsible whitespace. So if this
> is a default stylesheet for a UA implementation, and if the UA
> implements "\A" properly, then 'white-space:pre' should be unneccessary?

Correct. In fact, in the definition of the white-space property
(<http://www.w3.org/TR/REC-CSS2/text.html#white-space-prop>), it is
explicitly stated for each of the three possible values that a generated
"\A" will create a line break.


Tim Bagot

Received on Sunday, 18 February 2001 21:30:23 UTC