Re: Style rules to emulate HR

Ian Hickson wrote:
> 
> This group has a long history of shooting down proposed CSS rules for
> styling the default look of <br> elements, so I figured here would be the
> best place to ask:
> 
> What is wrong with the following?
> 
>    br {
>      display: block;
>    }
> 
>    br:before {
>      content: "\A";
>      white-space: pre; /* in case white-space applies to :before */


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.

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>.

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?


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?


Digressing somewhat, I notice in CSS2 10.8 Line height calculations:
'Empty inline elements generate empty inline boxes, but these boxes
still have margins, padding, borders and a line height, and thus
influence these calculations just like elements with content.'

I can't find anything similar for block boxes, but I assume these boxes
also have margins, padding, borders and a height and width?

(Though not much of either of these has been implemented.)


-- 
Regards,
Val Sharp - Edinburgh

Received on Sunday, 18 February 2001 19:07:54 UTC