RE: BR element and generated content

I don't think this is just about BR.

My reasoning for defining BR behavior is like this:
* BR is defined in HTML as an empty element. It can't have any conent
* Generated content is generated _inside_ its target element
* Then a rule like
        br:before { content:'\A' }
  puts content inside BR.
* But at this point I don't know what to do with it, since BR must be empty. It is no valid to have content inside it, and if it manages to get some what is it supposed to do with it?

Same issue applies to all other elements which either empty or have special rendering rules, e.g.
<imb>, <hr>, <tr> or <iframe>.

Try the attached example with different browsers and you'll see wildly different effect.

I'd like to have the expected behavior defined. I guess it belongs in CSS3 Generated Content. It currently does define this for <TR> (which can contain text) but not for <BR> or <IMG> (or I can't find it)...

IMO a good behavior would be to say that if element can't have text content, Generated Content just shouldn't apply.

-----Original Message-----
From: fantasai [mailto:fantasai.lists@inkedblade.net]
Sent: Friday, October 12, 2007 1:26 PM
To: Alex Mogilevsky
Cc: www-style@w3.org; Markus Mielke; Saloni Mira Rai; Arron Eicholz
Subject: Re: BR element and generated content

Alex Mogilevsky wrote:
> CSS2.1 default stylesheet defines <BR> element as
> br:before       { content: "\A" Alex Mogilevsky wrote:
> CSS2.1 default stylesheet defines <BR> element as
>
> br:before       { content: "\A" }
> > If taken literally, this means
>
> 1)      Generated content is applicable to <BR>
>
> 2)      If a non-default stylesheet clears br:before it should not break
> line lines.
>
> I am not sure these are intended consequences of this definition in the
> default stylesheet. Or are they?
>
> Note that none of current browsers implement (2) and I believe only
> opera has generated content have any effect on <BR>.

The default stylesheet is just a guideline: it's not normative.

Also, in CSS3 we'll be able to do
   br { white-space: pre; content: "\A"; }

I'm opposed to specifying normative behavior for <br> that requires
special-casing it. Implementing <br> as above should be allowed.

~fantasai

Received on Friday, 12 October 2007 21:44:24 UTC