# html2ps/pdf CSS 3 Compatibility List

Back to table of contents

## Media parameters

CSS 3 paged media module provides a means of controlling media size and margins. html2ps understangs 'size' and 'margin' properties when they're used in @page context; thus, you can set page size and margins in your CSS file, overriding defaults. For example:

    @page {
      size: 100mm 200mm;
      margin: 10mm;
    }

or

    @page {
      size: A4 landscape;
      margin: 5% 10mm;
    }

More complete information on 'size' and 'margin' value formats is available on w3c.org.

## Margin boxes

html2ps supports margin boxes in accordance to CSS 3. For example, you may render a header using the following CSS code:

    @page {
      @top-left {
        content: "My Page";
      }
      @top-right {
        content: "Page " counter(page) " of " counter(pages);
      }
    }

As an extension of the margin box specification, html2ps provides '-html2ps-html-content' property. In general, it is similar to 'content' property, except the resulting string is processed by HTML parser. Thus, you may use HTML tags in this property value.

    @page {
      @top-left {
        -html2ps-html-content: "&lt;span style=&quot;font-weight: bold;&quot;&gt;My&lt;/span&gt; Page";
      }
      @top-right {
        content: "Page " counter(page) " of " counter(pages);
      }
    }

Note that you may set text formatting using usual CSS propeties in margin box context:

    @page {
      @top-left {
        color: red;
        content: "My Page";
      }
      @top-right {
        content: "Page " counter(page) " of " counter(pages);
      }
    }

For further information please refer to CSS 3 Paged Media Module.

## Footnotes

## Properties

Property | Support | Note
--- | --- | ---

html2ps/pdf (c) TUFaT.com