Re: Center block within block?

Well, finally I have the chance to follow up on this :-)...  Many 
thanks to Ken, Dave T. and Dave P. for your responses.

Ken, you are spot on with your assumptions about what I was after.

A question for Dave Tolpin:  does RenderX handle Ken's technique 
correctly -- either the table version, or the inline-container version 
given in the post quoted below?

If I'm following Ken's remarks, the inner block should be wide enough 
for its contents and no wider, so space should show between its borders 
and those of the outer block.  But when I try it with XEP, the inner 
block gets the same width as the outer block.

In real life, these blocks have no borders, and the real trouble shows 
due to the fact that my inner block contains multiple lines (each in 
its own block), and these lines are supposed to be left-aligned (i.e. I 
have text-align="left" on the block that is supposed to be centered).

Thanks a lot,
Mark Lundquist


On Sunday, July 27, 2003, at 10:14 AM, G. Ken Holman wrote:

>
> At 2003-07-27 20:40 +0500, David Tolpin wrote:
>> >
>> > However ... the one way I can give you what I think you are asking 
>> for is
>> > to centre an auto-width table.  You have to rely on the auto-width
>> > algorithm as implemented by the processor to not wrap your lines, 
>> but as I
>> > said I think your line is probably short.
>> >
>>
>> For a single-line block, an inline in a block with text-aling="center"
>> will do exactly the same. No need for table-based layout. For a 
>> multi-line
>> block, I don't see how a table with table-layout="auto" can help.
>
> I illustrate how a table with table-layout="auto" can help in the 
> message:
>
>   http://lists.w3.org/Archives/Public/www-xsl-fo/2003Jul/0017.html
>
> Note how the border around the block has space between its start edge 
> and its parent's start edge, and between its end edge and its parent's 
> end edge.
>
> I'm assuming the block that the original poster is talking about is a 
> block of some content for some reason: he might have an explicit width 
> on the block, it might be a very short line that needs to be bordered 
> ... for some reason he is asking for a start and end indent *on a 
> block*, not *on the text in a block*, so I'm making the supposition 
> this is a special case not accommodated with inlines.
>
> Actually, as I write this, I realize the same effect as the auto-width 
> table can be accomplished with an inline-container, since an 
> inline-container can contain an arbitrary block:
>
> <block space-before="5cm" border="thin solid black"
>        xmlns="http://www.w3.org/1999/XSL/Format">
>   This is text in the outer space.
>   <block text-align="center">
>     <inline-container>
>       <block border="thin solid black">
>         and  centred  text (i-c).
>       </block>
>     </inline-container>
>   </block>
>   and more outer text
> </block>
>
> On Antenna House XSL Formatter the above produces the identical effect 
> as the auto-width table, in that the nested block of text has a box 
> around it and space entirely around the box inside the outer box of 
> the outer block.
>
> The original poster has not commented on my replies yet, so this is 
> still all supposition on my part trying to help in a situation that 
> isn't typical (otherwise the suggested simple answers would apply).  
> But all along I've been assuming that it isn't just the simple 
> centring of text, but the desire to centre a block of some width less 
> than the reference area in the centre of the inline-progression 
> dimension of the parent area.
>
> Again, if my suppositions are not correct (the original poster did not 
> give a lot of detail), then my suggestions may not apply.
>
> I hope this clarifies my efforts here.
>
> .................... Ken
>
>
> --
> Upcoming hands-on courses: in-house corporate training available;
> North America public:  XSL-FO Aug 4,2003; XSLT/XPath Aug 12, 2003
>
> G. Ken Holman                mailto:gkholman@CraneSoftwrights.com
> Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/f/
> Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999 (F:-0995)
> ISBN 0-13-065196-6                      Definitive XSLT and XPath
> ISBN 0-13-140374-5                              Definitive XSL-FO
> ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
> ISBN 1-894049-11-X              Practical Formatting Using XSL-FO
> Member of the XML Guild of Practitioners:    http://XMLGuild.info
> Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
>
>

Received on Monday, 4 August 2003 11:09:43 UTC