Re: [css2xslfo-support] Padding for top and bottom regions - continued for margins
Brought to you by:
wdonne
From: Werner D. <wer...@pi...> - 2011-09-22 08:56:17
|
Hi Sergey, CSS3 also has a concept like static regions, called margin boxes. The same principals are used there. The fact that I have used an ordinary block-level element to host the static regions is because I only support the CSS2 syntax. It is true that margins can be set on all block-level elements in CSS, but in this case their block-level nature is not the essence, because I use them to provide a concept that doesn't exist in CSS2. Perhaps I should have introduced the display type "region" and specify that margins don't apply to them, as it is also the case for certain other display types. The phenomenon of the h1 margin also occurs with XEP. It is because of the difference in space resolution rules between CSS and XSL-FO. Strictly speaking CSSToXSLFO is not compliant with CSS in all cases when it comes to margins. It generates the "space-before" property, which has a default conditionality of "discard". This causes margins to collapse in certain cases. For example, if two margins of different size abut the smallest one is discarded. This can be avoided by setting the conditionality explicitly to "retain". This is how CSS behaves, but it the results are horrible for type setting and it greatly complicates style sheets. In your specific case the effect of the body border is caused by the fact that the margin of the h1 element is no longer a space of a leading reference area. The border of the body gets this role and because of this the margin of the h1 element is not discarded. CSSToXSLO will not give you a pixel perfect layout when compared to the browser. It is just a convenient interface to the XSL-FO language. This is why compromises have been made. Best regards, Werner. On 22 Sep 2011, at 01:54, USHAKOV, Sergey wrote: > Hi Werner again, and sorry for the delay. > > I take your point on absense of the concept of margins for statics in XSL-FO. But not sure I am ready to agree with your completely :) > > In case when layout is translated from one description language to another (this is what, say, FOP does and this is what CSSToXSLFO does) it is not necessary that two description languages have very much in common, even at concept level. XSL-FO does not look much alike, say, PostScript. And still it does not prevent FOP from doing its job. > > And in case the target system does not have some concept that is supported by the source one, is looks natural for the user to expect the converter to take care of it, and to achieve the expected result with the tools available in the target system... > > That's why it looks natural to expect that if static regions are allowed to be expressed in HTML/CSS terms, then these CSS margins should appear in the output too... > > Well, I admit that margins for static regions may be argueable. But my eye was caught recently by one more phenomenon that looks unexpected to me. It looks like the topmost elemen in the body region does not get its top margin too. Please find an example attached. The 'h1' top margin is not honored. At least for me with FOP. It's also curious that if the body element gets a border, then this topmost child's margin gets honored too - just uncomment the appropriate CSS rule... > > My best regards, > Sergey > > > > ----- Original Message ----- From: "Werner Donné" <wer...@pi...> > To: "USHAKOV, Sergey" <us...@in...> > Cc: <css...@li...> > Sent: Monday, September 19, 2011 11:13 AM > Subject: Re: [css2xslfo-support] Padding for top and bottom regions > > > Hi Sergey, > > There are no margins for static regions in XSL-FO. You can set the margin on the body region instead. > > Best regards, > > Werner. > > On 18 Sep 2011, at 11:21, USHAKOV, Sergey wrote: > >> Hi Werner, >> >> preparing an example helped bringing thoughts in order quite a lot :) >> >> I was wrong partially, as nothing looks wrong about top regions. Any space required for them is sufficiently controlled with their "height" attribute. >> >> Still there seems to be a problem with bottom regions. You can control their height. You can apply borders. Paddings inside the borders behave as expected. But if you wish to have a non-zero top margin to separate the top border from the body region, then it seems to be ignored. Please find a sample attached. I have declared "margin-top" for the bottom region big enough, but the PDF that results from the generated FO shows no substantial gap between the body and the border... >> >> My best regards, >> Sergey >> >> >> ----- Original Message ----- From: "Werner Donné" <wer...@pi...> >> To: "USHAKOV, Sergey" <us...@in...> >> Cc: <css...@li...> >> Sent: Friday, September 16, 2011 11:35 AM >> Subject: Re: [css2xslfo-support] Padding for top and bottom regions >> >> >> Hi Sergey, >> >> The top and bottom regions have a fixed height and always abut on the body region. This means that whatever you put in them should fit this height. I would expect padding to work also for top and bottom regions. Perhaps you can send me the example? >> >> Best regards, >> >> Werner. >> >> On 16 Sep 2011, at 06:48, USHAKOV, Sergey wrote: >> >>> Hi Werner, >>> >>> I'm going ahead with my re-exploration of CSSToXSLFO features :) >>> >>> My next stop was at borders for top and bottom regions. My idea was to have >>> these regions separated from the body region by visible borders with >>> controllable margins and paddings. My idea was also to have all these >>> margins/borders/paddings belong to appropriate top/bottom regions rather >>> than to the body region for better flexibility. >>> >>> Everything is perfect wth margins and borders. But I did not succeed with >>> paddings. My impression is that CSS attributes for padding are not honored >>> for top and bottom regions, at least at joints with the body region. >>> >>> My workaround was adding extra empty 'div' elements to do the job for >>> paddings. But cannot say this looks elegant... >>> >>> Any ideas? >>> >>> Thanks in advance and best regards, >>> Sergey >>> >>> >>> ------------------------------------------------------------------------------ >>> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA >>> http://p.sf.net/sfu/rim-devcon-copy2 >>> _______________________________________________ >>> css2xslfo-support mailing list >>> css...@li... >>> https://lists.sourceforge.net/lists/listinfo/css2xslfo-support >> >> -- >> http://www.pincette.biz/ >> Handling your documents with care, wherever you are. >> <test.xhtml>------------------------------------------------------------------------------ >> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA >> http://p.sf.net/sfu/rim-devcon-copy2_______________________________________________ >> css2xslfo-support mailing list >> css...@li... >> https://lists.sourceforge.net/lists/listinfo/css2xslfo-support > > -- > http://www.pincette.biz/ > Handling your documents with care, wherever you are. > <test.xhtml>------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1_______________________________________________ > css2xslfo-support mailing list > css...@li... > https://lists.sourceforge.net/lists/listinfo/css2xslfo-support -- http://www.pincette.biz/ Handling your documents with care, wherever you are. |