SOLVED: PDF Target won't center horizontally w/ margin:auto?

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
Phlawm53
Sr. Propeller Head
Posts: 442
Joined: Tue Mar 16, 2010 10:58 am
Location: San Francisco, CA
Contact:

SOLVED: PDF Target won't center horizontally w/ margin:auto?

Post by Phlawm53 »

------
For Flare 11, although I *suspect* this isn't a version-specific problem(?) If it is, then I may finally get 'round to upgrading...

Q: I can use CSS to horizontally center an image in a DIV in online outputs, but can't make the same CSS work in my print CSS medium.


As described "everywhere", the CSS used to center an image is as follows:

Code: Select all

	img.centered
	{
		display: block;
		margin-left: auto;
		margin-right: auto;
		border: solid 2px purple;
		width: 4in;
		height: auto;
	}
(The purple border is there to enable me to be sure I'm working with the right medium in both my CSS and my outputs.)

LOTS of CSS resources explain that the "trick" to centering something horizontally is the margin: auto; bit combined with display:block; for IMGs plus a width specification.
  • In an HTML5 medium, applying the centered CSS class centers the image in the output (but NOT the XML editor). (I use a different colored border to ensure I'm in the correct part of the CSS...)
  • In a print/PDF medium, the same class -- even if instantiated separately in the @media print section -- does NOT center the image, ever.
I've encountered other situations where Flare's PDF engine does not respect certain CSS elements or attributes.

Is this another of those situations? Asked another way, are other Flare users centering IMGs with the CSS given above? Or?

Cheers & thanks for your help,
Riley
SFO
Phlawm53
Sr. Propeller Head
Posts: 442
Joined: Tue Mar 16, 2010 10:58 am
Location: San Francisco, CA
Contact:

Re: SOLVED: PDF Target won't center horizontally w/ margin:a

Post by Phlawm53 »

------

Ah yes, almost never fails: Post a question, find the answer on your own.

The "trick" seems to be to define the left and right margins as 50% rather than auto.

Now working in the print medium...

Cheers & hope this helps,
Riley
Post Reply