Like floats, the PDF software does support
absolute positioning of block elements in PDFs, but there are specific restrictions. These include:
Only block elements can be
absolutepositioned (remember, all HTML is hard-coded as either block or inline).
The element you want positioned needs to be a top-level tag in the template. Positioning won't work if the element is nested inside another.
All positioning is relative to the current PDF page
You cannot nest fixed position elements inside other fixed position elements
Positioning is overridden if it would position the element off the page
mPDF can start acting quirky if the page only contains positioned elements. A simple workaround is to add a non-breaking space character
to the page.
Absolute positioning treats the whole physical page as the containing element, irrespective of the page margins. That means if we set the top and left CSS attributes to zero your HTML would be at the very top-left corner of the page.
As oppose to absolute positioning, fixed positioned elements adhere to the page margins (set using the CSS margin attribute in
@page), using it as the container. That means setting the top and left CSS attributes to zero would show your HTML positioned at the very beginning of the page margins.
Like tables, fixed or absolute positioned elements can be rotated 90 degrees clockwise and anti-clockwise:
Auto Fit Text
One of the great features of positioned elements is the ability to have the text resize to fit the container. This is very useful when working with dynamic data from Gravity Forms.