- From: Stuart Ballard <sballard@netreach.com>
- Date: Fri, 17 May 2002 10:17:05 -0400
- To: Bert Bos <bert@w3.org>
- CC: www-style@w3.org
Bert Bos wrote: > > "CSS3 module: line" > > This document presents a set of CSS line formatting properties. It > also includes baseline alignment features as well as related > functions like initial line and initial letter effect. It extends > on the CSS 2 model > > http://www.w3.org/TR/2002/WD-css3-linebox-20020515 One thing missing that I've wanted for some time is the capability to do something like what email does with quoting - ie add a single thing to the start of each line. My suggestion for this in the past was an :every-line pseudo-class, eg: blockquote.cite:every-line:before { content: '> ' } Limitations: I've heard comments about how this would be hard to implement, and in response to these I added the following caveats which theoretically should make it pretty easy to implement, although some of the limitations really do limit its use somewhat (see examples below). 1) :every-line can only be used on elements with display: block. 2) :every-line cannot be styled directly; only the :before and :after pseudo-classes can be styled. 3) The contents of :before and :after are always rendered with the style of the block, and do not inherit text styles that apply to any inline elements that happen to apply to the text before and after the line-break. So that text which would be rendered some <b>bold text</b> here will be rendered as > some <b>bold > text</b> here but *neither* of the ">"s will be bold. With these restrictions it's pretty easy to implement :every-line - you can figure out the exact width and height of the contents of the 'before' and 'after' parts, calculate your line-height based on that, and do your existing word-wrapping algorithm after *subtracting* the combined widths of the :before and :after. Special Cases: We should specify something to do if the combined width of :before and :after ends up being longer than a line - perhaps just treat them as :before and :after the whole block in that case. We should also probably specify that unless that special case is hit, :before and :after on :every-line will never word-wrap themselves. We should also specify what to do with nested block-elements that all have :every-line stuff done on them, and whether the :every-line ever applies to the space *between* blocks - eg whether it's possible to make <blockquote><p>a</p><p>b</p></blockquote> render as > a > > b If the Limitations Were Relaxed: For completeness, here is an example of a case where relaxing (1) would make a useful effect available. The consequences of relaxing (3) are pretty obvious, although it's not clear to me whether they're desirable or not. Relaxing (2) doesn't make much sense, IMO. Here's the example that works only if (1) is relaxed... (sorry, I don't have the single-character versions of << and >> on my keyboard) q:before { content: '<<' } q:after { content: '>>' } q:every-line:before { content: '<< ' } Here is some text that includes <q>a quotation from somebody, that says something</q>. It has some text afterwards, too. Here is some text that includes <<a quotation << from somebody, that says << something>>. It has some text afterwards, too. From what was mentioned in the previous discussion I had about this feature, it seems that in some areas quoting styles like that are conventionally used - it would be nice for CSS to support that, I guess. IMO it wouldn't make the implementation *too* much harder, but I think making it block-only would be useful, too. Thoughts? Stuart. -- Stuart Ballard, Programmer NetReach - Internet Solutions (215) 283-2300, ext. 126 http://www.netreach.com/
Received on Friday, 17 May 2002 10:17:15 UTC