Movatterモバイル変換


[0]ホーム

URL:


mPDF Manual – CSS & Stylesheets

Supported CSS

Supported CSS attributes - stylesheets or in-line

Unless otherwise stated, the following values are supported:

LENGTH

px,pc,pt,cm,mm,in,em,rem,ex and% (where appropriate) are supported.Default if no unit given ispx.

FONT-SIZE

px,pc,pt,em,rem,ex,%,small,medium,large,x-small,x-large are supported.Default if no unit given ispx.

Note: Support forrem was added in mPDF 5.7. Unlike the CSS3 specification, the basic size used forrem in the document is based on thefont-size set on the<body> element (rather than the<html> element).

Conversion frompx is determined by the configurable variablesdpiandimg_dpi

ex uses an approximation of half the font height

FONT-FAMILY

Any font family defined in your configuration, as well assans,sans-serif,serif ormonospace.

ALPHA

transparency, value between0 and1

COLOR

#rgb or#rrggbb orrgb(255,255,255) orcolour names e.g.black,gray are supported.

Also supported are:

  • rgb(255, 255, 255)
  • rgba(255, 255, 255, 1) last value isALPHA *
  • rgb(100%, 100%, 100%)
  • hsl(360, 100%, 100%)
  • hsla(360, 100%, 100%, 1) last value isALPHA *
  • cmyk(100, 100, 100, 100)[or 0-100%]
  • cmyka(100, 100, 100, 100, 1)[or 0-100%] last value isALPHA *
  • device-cmyk(100, 100, 100, 100)[or 0-100%]
  • device-cmyka(100, 100, 100, 100, 1) last value isALPHA *
  • spot(<color name>, 100%). (cf.AddSpotColor)

since mPDF 5.7, spotcolor CMYK values can be defined as it is used e.g.color: spot(PANTONE 534 EC, 100%, 85, 65, 47, 9);

* Alpha values (transparency) are only supported on background colours - not text color

GRADIENT

Both the Mozilla or the draft CSS3 syntax are supported e.g.:

  • background: -moz-repeating-linear-gradient(red, blue 20px, red 40px)
  • background-image: -moz-repeating-linear-gradient(red, blue 20px, red 40px)
  • background: linear-gradient(top, #c7cdde, #f0f2ff);
  • background-image: linear-gradient(top, #c7cdde, #f0f2ff);

There are more values supported.(cf.Backgrounds & borders)

GRADIENT_OLD

background-gradient: GRADIENT_OLD isdeprecated

Defines a linear or radial colour gradient for the background.

  • linearCOLOR1COLOR2 x1 y1 x2 y2; or
  • radialCOLOR1COLOR2 x1 y1 x2 y2 radius;

x,y andradius are values between0 and1

(custom attribute) (cf.Backgrounds & borders)

HTML TagPropertyValues allowed & Notes
BODYdirectionrtl | ltr (mPDF ≥ 5.0)
COMMON TEXT STYLESSeebelow - all except text-shadow

margin-collapse

collapse|none (custom attribute - collapses top and bottom margins if at top or bottom of page)
line-height

Line height as a factor of font-height. Usual values around 1.2 or 1.3

Also acceptspx,pc,pt,cm,mm,in,em and% (mPDF ≥ 4.0)

background, background-image, background-position, background-repeat, background-color

background is parsed as per the CSS specification.

background-image in the formurl(image.png) orurl('image.png') orGRADIENT (mPDF ≥ 5.1).

background-position is supported as per CSS2.1

background-repeat: repeat | repeat-x | repeat-y | no-repeat

background-attachment is parsed but has no effect.

See note below. (cf.Backgrounds & borders)

(All except background-color added mPDF 3.0)

background-image-resolution

normal | [ from-image <dpi> ]  (mPDF ≥ 5.1)

Custom tag, but as for image-resolution in CSS3

background-gradient

(Deprecated)GRADIENT_OLD

background-image-opacity

Value between 0 and 1.0

Sets the opacity/transparency of the background image.

background-image-resize

0 - No resizing (default)

1 - Shrink-to-fit w (keep aspect ratio)

2 - Shrink-to-fit h (keep aspect ratio)

3 - Shrink-to-fit w and/or h (keep aspect ratio)

4 - Resize-to-fit w (keep aspect ratio)

5 - Resize-to-fit h (keep aspect ratio)

6 - Resize-to-fit w and h

All Block level tags: P, DIV, H1-H6, OL, UL, ADDRESS, BLOCKQUOTE, CAPTION, CENTER, DL, DT, DD, FORM, ARTICLE, ASIDE, DETAILS, FIELDSET, FIGURE, FIGCAPTION, FOOTER, HEADER, HGROUP, NAV, SECTION, SUMMARYmargin*, margin-top, margin-bottom, margin-left, margin-rightLENGTH
padding*, padding-right, padding-left, padding-top, padding-bottomLENGTH
border, border-top, border-bottom, border-left, border-right

Size style and colour e.g.

LENGTH solid|dotted|dashed|doubleCOLOR

border-color*, border-top-color, border-right-color, border-bottom-color, border-left-color

COLOR

(mPDF ≥ 4.0)

border-width*, border-top-width, border-right-width, border-bottom-width, border-left-width

LENGTH 

(mPDF ≥ 4.0)

border-style*, border-top-style, border-right-style, border-bottom-style, border-left-style

solid | dotted | dashed | double

(mPDF ≥ 4.0)

(double was added mPDF 4.2)

border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius

LENGTH

Seedraft CSS3 specification for use.

NB Use of$autoPadding which can automatically increase padding in block elements with border-radius set as required

width

LENGTH

mPDF does not support nested block elements which overlap (horizontally or vertically) i.e. the inner block must be contained by the outer block’s physical dimensions. width and height are overridden if this is not the case.

height

LENGTH 

mPDF does not support nested block elements which overlap (horizontally or vertically) i.e. the inner block must be contained by the outer block’s physical dimensions. width and height are overridden if this is not the case.

(Prior to mPDF v5.1: only supported if whole block is all on one page; will extend a block but not shorten it; will not force a pagebreak even if height should move onto next page.)

NB % is interpreted as % of printable page height (inside margins)

text-alignleft | center | right | justify
page-break-afterauto | avoid | always | left | right (extended mPDF ≥ 5.4)
page-break-inside avoid (avoids a page-break within the block - only works across max. of 2 pages; not compatible with table autosize or table rotate)
page-break-beforealways | left | right
displaynone
visibility

visible | hidden |printonly |screenonly  (mPDF ≥ 5.4)

margin-collapse

collapse | none (custom attribute - collapses top and bottom margins if at top or bottom of page)
line-height

Line height as a factor of font-height. Usual values around 1.2 or 1.3

Also accepts px, pc, pt, cm, mm, in, em and % (mPDF ≥ 4.0)

‘normal’ also accepted (set by default to 1.3 in mPDF)

line-stacking-strategy

inline-line-height | block-line-height | max-height | grid-height

As per draft CSS3 spec. (mPDF ≥ 6.0)

Default = inline-line-height

line-stacking-shift

consider-shifts | disregard-shifts

As per draft CSS3 spec. (mPDF ≥ 6.0)

Default = consider-shifts

background, background-image, background-position, background-repeat, background-color

background is parsed as per the CSS specification.

background-image in the formurl(image.png) orurl('image.png') orGRADIENT (mPDF ≥ 5.1).

background-position is supported as per CSS2.1

background-repeat: repeat | repeat-x | repeat-y | no-repeat

background-attachment is parsed but has no effect.

See note below. (cf.Backgrounds & borders)

(All except background-color added mPDF 3.0)

background-clip

padding-box | border-box (default=border-box)

extended to include “content-box” from mPDF 5.7

background-origin

padding-box | content-box | border-box  (default padding-box)

As per CSS3. mPDF ≥ 5.7

background-size

[ <length> | <percentage> | auto ]{1,2} | cover | contain  (default = auto)

As per CSS3. mPDF ≥ 5.7

background-image-resolution

normal | [ from-image <dpi> ]  (mPDF ≥ 5.1)

Custom tag, but as for image-resolution in CSS3

background-gradient

(Deprecated)GRADIENT_OLD

background-image-opacity

Value between 0 and 1.0

Sets the opacity/transparency of the background image.

background-image-resize

0 - No resizing (default)

1 - Shrink-to-fit w (keep aspect ratio)

2 - Shrink-to-fit h (keep aspect ratio)

3 - Shrink-to-fit w and/or h (keep aspect ratio)

4 - Resize-to-fit w (keep aspect ratio)

5 - Resize-to-fit h (keep aspect ratio)

6 - Resize-to-fit w and h

box-shadow

As per CSS3 specification. ‘inset’ is not supported.

(mPDF ≥ 5.4)

box-decoration-break

slice | clone  (default = slice)

Defines the handling of padding and borders at page breaks, whenclonebycss set

z-index

Sets a layer in the PDF document.

Note: this is not the same as a “layer” in CSS terms. SeeLayers.

All Block level tags: P, DIV, H1-H6, OL, UL, ADDRESS, BLOCKQUOTE, CAPTION, CENTER, DL, DT, DD, FORM, ARTICLE, ASIDE, DETAILS, FIELDSET, FIGURE, FIGCAPTION, FOOTER, HEADER, HGROUP, NAV, SECTION, SUMMARY (contd.)COMMON TEXT STYLESSeebelow

text-indent

Indents first line of text in the paragraph/block.

LENGTH

(Indent is disabled in tables.)

Negative value will give a ‘hanging indent’.

position

fixed | absolute

absolute - uses physical page as containing element;

fixed - uses printable page (inside margins) as containing element.

(mPDF ≥ 4.0)

NB Only supported for top-level elements i.e. where the parent element is <body>. Fixed-position or floating elements nested inside other fixed-position or floating elements are not supported.

overflow

visible | hidden | auto

Applies to block elements with position fixed or absolute. auto - causes text to autofit within the block size (constrained if necessary to page edges).

(mPDF ≥ 4.0)

hyphens

none | manual | auto (default = manual)

As per CSS. (mPDF  ≥ 5.7)

rotate

90 | -90

Applies only to block elements with position fixed or absolute. (mPDF ≥ 5.0)

Sizing and layout of the block element using top, left, bottom, right, width and height are applied BEFORE the element is rotated. The top and left co-ordinates are respected for positioning, except when bottom or right are specified without respective top or left when the bottom/right co-ordinates are used.

top, left, bottom, right

LENGTH

Applies to block elements with position fixed or absolute.

(mPDF ≥ 4.0)

float

left | right

Partially supported as for CSS2 property.

NB Fixed-position or floating elements nested inside other fixed-position or floating elements are not supported.

clearleft | right | both
pageSpecify a named page selector (see @page)
directionrtl | ltr (mPDF ≥ 5.1)
HTML TagProperty     Values allowed & Notes
LIST tags: OL, ULlist-style[ 'list-style-type' 'list-style-position' 'list-style-image' ]   mPDF ≥ 6.0
list-style-type* *

1 | A | a | I | i | disc | circle | square | decimal | lower-roman | upper-roman | lower-latin | upper-latin | lower-alpha | upper-alpha | none

arabic-indic | bengali | cambodian | cjk-decimal | devanagari | gujarati | gurmukhi | hebrew |kannada | khmer | lao | malayalam | oriya | persian | telugu | thai | urdu | tamil

“1” - decimal

“A” = upper-latin

“a” = lower-latin

“I” = upper-roman

“i” = lower-roman

Custom list-style-type is recognised e.g.:U+263Argb(255,0,0);

  • whereU+263A is the Unicode HEX value of the character you want for the bullet
  • the character MUST be included in the font used for that list item
  • rgb() bit is optional
list-style-image

<URI>

mPDF ≥ 6.0

list-style-position

inside | outside  (default = outside)

mPDF ≥ 6.0

 

NB Lists are handled as block-level elements as from mPDF 6.0 (see above)

LIlist-style

[ ‘list-style-type’ ‘list-style-position’ ‘list-style-image’ ]  

mPDF ≥ 6.0

list-style-type* *

1 | A | a | I | i | disc | circle | square | decimal | lower-roman | upper-roman | lower-latin | upper-latin | lower-alpha | upper-alpha | none

arabic-indic | bengali | cambodian | cjk-decimal | devanagari | gujarati | gurmukhi | hebrew |kannada | khmer | lao | malayalam | oriya | persian | telugu | thai | urdu | tamil

“1” - decimal

“A” = upper-latin

“a” = lower-latin

“I” = upper-roman

“i” = lower-roman

Custom list-style-type is recognised e.g.:U+263Argb(255,0,0);

  • whereU+263A is the Unicode HEX value of the character you want for the bullet
  • the character MUST be included in the font used for that list item
  • rgb() bit is optional
list-style-image

<URI>

mPDF ≥ 6.0

list-style-position

inside | outside  (default = outside)

mPDF ≥ 6.0

 

NB Lists are handled as block-level elements as from mPDF 6.0 (see above)

HTML TagPropertyValues allowed & Notes
All Inline tags: SPAN, A, SUB, SUP,  ACRONYM, BIG, SMALL, INS, S, STRIKE, DEL, STRONG, CITE, Q, EM, B, I, U, SAMP, CODE, KBD, TT, VAR, FONT, TIME, MARKCOMMON TEXT STYLESSeebelow
border, border-top, border-bottom, border-left, border-right

Size style and colour e.g.

LENGTH solid|dotted|dashed|doubleCOLOR

(mPDF ≥ 5.4)

border-color*, border-top-color, border-right-color, border-bottom-color, border-left-color

COLOR

(mPDF ≥ 5.4)

border-width*, border-top-width, border-right-width, border-bottom-width, border-left-width

LENGTH 

(mPDF ≥ 5.4)

border-style*, border-top-style, border-right-style, border-bottom-style, border-left-style

solid | dotted | dashed | double

(mPDF ≥ 5.4)

background-color, backgroundCOLOR (only the color is supported in background)
displaynone (mPDF ≥ 5.0)
visibility

hidden | visible | printonly | screenonly (default = visible)

(mPDF ≥ 5.7)

hyphens

none | manual | auto (default = manual)

As per CSS. (mPDF  ≥ 5.7)

HTML TagPropertyValues allowed & Notes
TABLEbackground-colorCOLOR
background, background-image, background-position, background-repeat, background-color

background is parsed as per the CSS specification.

background-image in the formurl(image.png) orurl('image.png') orGRADIENT.

background-position is supported as per CSS2.1

background-repeat: repeat | repeat-x | repeat-y | no-repeat

background-attachment is parsed but has no effect.

See note below. (cf.Backgrounds & borders)

(All except background-color added mPDF 5.1)

background-image-resolution

normal | [ from-image <dpi> ]  (mPDF ≥ 5.1)

background-image-opacity

Value between 0 and 1.0

Sets the opacity/transparency of the background image.

COMMON TEXT STYLESSeebelow - except text-decoration, text-transform and text-shadow
border, border-right, border-left, border-top, border-bottom

Size style and colour e.g.

LENGTH double | solid | dashed | dotted | ridge | outset | groove | inset | hidden | noneCOLOR 

NB Table & cell borders accept: double | solid | dashed | dotted | ridge | outset | groove | inset (other block elements only support solid | dotted | dashed | double)

border-color*, border-top-color, border-right-color, border-bottom-color, border-left-color

COLOR

(mPDF ≥ 4.0)

border-width*, border-top-width, border-right-width, border-bottom-width, border-left-width

LENGTH 

(mPDF ≥ 4.0)

border-style*, border-top-style, border-right-style, border-bottom-style, border-left-style

double | solid | dashed | dotted | ridge | outset | groove | inset | hidden | none

(mPDF ≥ 4.0)

padding*, padding-right, padding-left, padding-top, padding-bottom

LENGTH

(mPDF ≤ 1.3 incorrectly set cell-padding for all cells in table.)

Sets table padding (only relevant whenborder-collapse:separate)

margin*, margin-right, margin-left, margin-top, margin-bottomLENGTH
widthLENGTH
vertical-aligntop | middle | bottom (applies to all cells in table)
text-align left | right | center (applies to all cells in table; to centre a table on the page, you must use the align="center" attribute in the table tag)
border-collapsecollapse | separate
border-spacing

Single or double values:

2px sets horizontal and vertical;

2px 3px sets horizontal=2 and vertical=3

(Same as cellSpacing attribute) Default=2px

empty-cellshide | show (only relevant when border-collapse:separate)
page-break-insideavoid
page-break-after

left | right | always

(mPDF ≥ 5.4)

rotate

rotates the table 90 degress clockwise (90) or counter-clockwise (-90). Does not work with columns, and bookmarks will not be correctly placed (custom attribute)

autosize

Shrinks a table to fit if width is too small to allow complete words to fit. The value (must be ≥1) determines the maximum allowable factor to shrink i.e. `autosize="2"` will allow the font-size to be reduced to a minimum of 1/2 the original size. A value of 1 prevents automatic resizing of the table. (custom property)

topntail

Sets border at top and bottom of table, and below THEAD row if present. (custom attribute)

thead-underline

Sets border at bottom of THEAD row if present. (custom attribute added mPDF v1.1)
line-heightSets default line-height for table cells as factor or % (value e.g. 1.3)
line-stacking-strategy

inline-line-height | block-line-height | max-height | grid-height

As per draft CSS3 spec. (mPDF ≥ 6.0)

Default = inline-line-height

line-stacking-shift

consider-shifts | disregard-shifts

As per draft CSS3 spec. (mPDF ≥ 6.0)

Default = consider-shifts

overflow

auto | hidden | visible | wrap

Controls table layout if minimum width is too wide for page.

directionrtl | ltr (mPDF ≥ 5.1)
CAPTIONcaption-sidetop | bottom (mPDF ≥ 5.4) Right and left are not supported
THEAD, TFOOTfont-weightnormal | bold
vertical-aligntop | middle | bottom
text-alignleft | center | right
TRbackground-colorCOLOR
background, background-image, background-position, background-repeat, background-color

background is parsed as per the CSS specification.

background-image in the form url(image.png) or url(‘image.png’) orGRADIENT.

background-position is supported as per CSS2.1

background-repeat: repeat | repeat-x | repeat-y | no-repeat

background-attachment is parsed but has no effect.

See note below. (cf.Backgrounds & borders)

(All except background-color added mPDF 5.1)

background-image-opacity

Value between 0 and 1.0

Sets the opacity/transparency of the background image.

border, border-right, border-left, border-top, border-bottom

Size style and colour e.g.

LENGTH double | solid | dashed | dotted | ridge | outset | groove | inset | hidden | noneCOLOR 

NB Table & cell borders accept: double | solid | dashed | dotted | ridge | outset | groove | inset | hidden | none (other block elements only support solid | dotted | dashed | double)

(mPDF ≥ 5.1)

border-color*, border-top-color, border-right-color, border-bottom-color, border-left-color

COLOR

(mPDF ≥ 5.1)

border-width*, border-top-width, border-right-width, border-bottom-width, border-left-width

LENGTH 

(mPDF ≥ 5.1)

border-style*, border-top-style, border-right-style, border-bottom-style, border-left-style

double | solid | dashed | dotted | ridge | outset | groove | inset | hidden | none

(mPDF ≥ 5.1)

text-rotate

Rotate the text inside table cells for this row. Accepted values are 1 - 90 for degrees anticlockwise, or -90 (only) for clockwise rotation. (custom attribute)
:nth-child() SELECTOR* *

odd | even |an+b

As per CSS3 specification

page-break-before, page-break-after

avoid | allow

Allows grouping of table rows and avoiding page breaks between two pages inside a group. since 8.2.4

TD, THbackground, background-image, background-position, background-repeat, background-color

background is parsed as per the CSS specification.

background-image in the formurl(image.png) orurl('image.png') orGRADIENT (mPDF ≥ 5.1).

background-position is supported as per CSS2.1

background-repeat: repeat | repeat-x | repeat-y | no-repeat

background-attachment is parsed but has no effect.

See note below.

(All except background-color added mPDF 3.2)

background-gradient

(Deprecated)GRADIENT_OLD

(Added mPDF 3.2)

background-image-opacity

Value between 0 and 1.0

Sets the opacity/transparency of the background image.

background-image-resize

0 - No resizing (default)

1 - Shrink-to-fit w (keep aspect ratio)

2 - Shrink-to-fit h (keep aspect ratio)

3 - Shrink-to-fit w and/or h (keep aspect ratio)

4 - Resize-to-fit w (keep aspect ratio)

5 - Resize-to-fit h (keep aspect ratio)

6 - Resize-to-fit w and h

border, border-right, border-left, border-top, border-bottom

Size style and colour e.g.

LENGTH double | solid | dashed | dotted | ridge | outset | groove | inset | hidden | noneCOLOR 

NB Table & cell borders accept: double | solid | dashed | dotted | ridge | outset | groove | inset | hidden | none (other block elements only support solid | dotted | dashed | double)

border-color*, border-top-color, border-right-color, border-bottom-color, border-left-color

COLOR

(mPDF ≥ 4.0)

border-width*, border-top-width, border-right-width, border-bottom-width, border-left-width

LENGTH 

(mPDF ≥ 4.0)

border-style*, border-top-style, border-right-style, border-bottom-style, border-left-style

double | solid | dashed | dotted | ridge | outset | groove | inset | hidden | none

(mPDF ≥ 4.0)

padding*, padding-right, padding-left, padding-top, padding-bottomLENGTH
widthLENGTH
heightLENGTH (but not %) (mPDF ≥ 4.0)
COMMON TEXT STYLESSeebelow
white-spacenowrap
vertical-aligntop | middle | bottom
text-align

left | right | center

From mPDF 5.7, also supports a decimal-mark alignment followed by a default e.g.

text-align: '.' center;

Non-ASCII characters should be defined using Unicode values:

text-align: '\66B' center;

text-rotate

Rotates the text in a table cell. Accepted values are 1-90 for degrees anticlockwise, or -90 (only) for clockwise rotation. (custom attribute)
line-stacking-strategy

inline-line-height | block-line-height | max-height | grid-height

As per draft CSS3 spec. (mPDF ≥ 6.0)

Default = inline-line-height

line-stacking-shift

consider-shifts | disregard-shifts

As per draft CSS3 spec. (mPDF ≥ 6.0)

Default = consider-shifts

hyphens* *

none | manual | auto (default = manual)

As per CSS. (mPDF  ≥ 5.7)

:nth-child() SELECTOR

odd | even |an+b

As per CSS3 specification

directionrtl | ltr (mPDF ≥ 6.0)
HTML TagPropertyValues allowed & Notes
HRwidthLENGTH
text-alignleft | right | center
colorCOLOR
heighti.e. line-width.LENGTH
margin-top, margin-bottomLENGTH
margin-left, margin-rightauto | 0 (only) are supported as an alternative way to align a HR of less than 100% width. Values for margin-left: 0; margin-right: auto; will align the HR to the left etc.
clearleft | right | both
IMGvertical-align

top | middle | bottom | baseline | text-bottom | text-top

(Full support only from mPDF 4.2)

margin, margin-right, margin-left, margin-top, margin-bottomLENGTH
border, border-right, border-left, border-top, border-bottom

Must be full declaration of size style and colour e.g.

0.1pt solid | dotted | dashed #cccccc

Will also accept#cccccc 0.1pt solid (which is generated by IE WYSIWYG editor)

and (from mPDF 1.4)solid 3mm #000000

medium | thin | thick accepted for size

padding*, padding-right, padding-left, padding-top, padding-bottomLENGTH
background-colorCOLOR  (mPDF ≥ 5.7.3) 
opacity

Value between 0 and 1.0

CSS3 recommended property (but already supported by Firefox)

Sets the opacity/transparency of the image.

image-orientationANGLE as deg, rad, or grad (as per draft CSS3)  mPDF ≥ 5.1
image-resolution

normal | [ from-image <dpi> ] (as per draft CSS3)  mPDF ≥ 5.1

image-rendering

auto | crisp-edges | optimizequality | smooth  (as per draft CSS3)

(mPDF ≥ 6.0)

Controls whether interpolation is on or off in PDF document. Once set for an image, subsequent use of the same image will use the initial setting for this property.

auto (default) - uses the value set by config variable:$interpolateImages

crisp-edges - interpolation disabled

optimizequality - interpolation enabled

smooth - interpolation enabled

gradient-mask

GRADIENT_OLD  mPDF ≥ 5.1
displaynone
visibility

visible | hidden |printonly |screenonly  (mPDF ≥ 5.4)

transform

All CSS3 transform functions are supported except matrix() i.e.

translate(), translateX(), translateY()

skew(), skewX(), skewY()

scale(), scaleX(), scaleY()

rotate()

cf.http://www.w3.org/TR/css3-transforms/#typedef-transform-function

floatleft | right (cf.Images)
z-indexSets a layer in the PDF document. SeeLayers.
(vspace, hspace)Attributes - set values for margin-left/right or margin-top/bottom
width, heightLENGTH. NB the inline attributes `width=""` and `height=""` are also supported
min-width, min-height, max-width, max-heightLENGTH. (mPDF ≥ 5.6)
SELECTfont-familyFONT-FAMILY
font-sizeFONT-SIZE
colorCOLOR
TEXTAREAwidth, heightLENGTH. NB the inline attributes cols="" and rows="" are also supported
font-familyFONT-FAMILY
font-sizeFONT-SIZE
colorCOLOR
vertical-align

top | middle | bottom | baseline | text-bottom | text-top

(Full support only from mPDF 4.2)

border-colorCOLOR  Active Forms only (mPDF ≥ 5.3)
background-colorCOLOR  Active Forms only (mPDF ≥ 5.3)
INPUT (type=IMAGE)width, heightLENGTH
INPUT (type=BUTTON| SUBMIT|RESET)font-familyFONT-FAMILY  Active Forms only (mPDF ≥ 5.3)
font-sizeFONT-SIZE  Active Forms only (mPDF ≥ 5.3)
colorCOLOR  Active Forms only (mPDF ≥ 5.3)
border-colorCOLOR  Active Forms only (mPDF ≥ 5.3)
background-colorCOLOR  Active Forms only (mPDF ≥ 5.3)
INPUT (type=CHECKBOX| RADIO)font-sizeFONT-SIZE (sets size of glyph). Not inherited.
colorCOLOR. Not inherited.
INPUT (type=PASSWORD| TEXT)widthLENGTH. NB the inline attribute size="" is also supported
font-familyFONT-FAMILY
font-sizeFONT-SIZE
colorCOLOR
border-colorCOLOR  Active Forms only (mPDF ≥ 5.3)
background-colorCOLOR  Active Forms only (mPDF ≥ 5.3)
BRclearleft | right | both
DOTTAB

outdent

LENGTH. (mPDF ≥ 5.7)
@page @page <named> size

<length>{1,2} | auto | portrait | landscape

Note: ‘em’ ‘ex’ and % are not allowed

Length values are width and height e.g.size: 8.5in 11in; or one value for a square.

Sets the size of the ‘page-box’, which is usually used with a constant size sheet through the document, as in the CSS2 @paged media spec.

sheet-size

<length>{2} | A4 | A4-L etc.

Note: ‘em’ ‘ex’ and % are not allowed

Length values are width and height e.g.size: 8.5in 11in; Any of the standard sheet sizes can be used (as for mPDF() ) with the suffix-L for landscape

odd-header-name, even-header-name, odd-footer-name, even-footer-name

A named Header or Footer. HTML headers/footers must precede the name with$html_

NB This was the original form, and still takes preference over header and footer which can be set using the pseudo-selectors e.g. :right

The name_default can be used to allow the current non-HTML header to remain unchanged (mPDF ≥ 5.1)

margin, margin-left, margin-right, margin-top, margin-bottomLENGTH (% refers to page-box width for left/right, of height for top/bottom)
@page   @page :right @page :left @page :first @page <named>margin-top, margin-bottom

LENGTH (% refers to page-box width for left/right, of height for top/bottom)

Note that left and right margins cannot be changed when using a page selector.

@page :first is not recognised unless @page has been set with some CSS properties

margin-header, margin-footer

LENGTH
marks

crop | cross | none

From mPDF 5.1 crop and cross can be used together.

header, footer

A named Header or Footer. HTML headers/footers must precede the name with$html_ (from mPDF 4.2)

background, background-image, background-position, background-repeat, background-color

background is parsed as per the CSS specification.

background-image in the formurl(image.png) orurl('image.png') supported.

background-position is supported as per CSS2.1

background-repeat: repeat | repeat-x | repeat-y | no-repeat

background-attachment is parsed but has no effect.

See note below. (cf.Backgrounds & borders)

background-image-opacity

Value between 0 and 1.0

Sets the opacity/transparency of the background image.

background-image-resize

0 - No resizing (default)

1 - Shrink-to-fit w (keep aspect ratio)

2 - Shrink-to-fit h (keep aspect ratio)

3 - Shrink-to-fit w and/or h (keep aspect ratio)

4 - Resize-to-fit w (keep aspect ratio)

5 - Resize-to-fit h (keep aspect ratio)

6 - Resize-to-fit w and h

background-gradient

(Deprecated)GRADIENT_OLD

resetpagenum

INTEGER Reset page numbering. Use with:first

pagenumstyle

1 | A | a | I | i  See <pagebreak> for details

suppress

on | off | 1 | 0 

See <pagebreak> for details

Common Text Styles

COMMON TEXT STYLES are:

font-familyFONT-FAMILY
font-sizeFONT-SIZE
font-styleitalic | oblique | normal
font-weightbold | normal (only)
fontShorthand form, as per CSS2 specification (mPDF ≥ 4.0)
font-variant

normal | none | [ <common-lig-values> <discretionary-lig-values> <historical-lig-values> <contextual-alt-values>

historical-forms

[ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ]

<numeric-figure-values> <numeric-spacing-values> <numeric-fraction-values>

ordinal

slashed-zero ]

(mPDF ≥ 6.0)

font-variant-position

normal | sub | super

(mPDF ≥ 6.0)

font-variant-caps

normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps

(mPDF ≥ 6.0)

font-variant-ligatures

normal | none | [

<common-lig-values> <discretionary-lig-values> <historical-lig-values> <contextual-alt-values> ]

(mPDF ≥ 6.0)

<common-lig-values> = [ common-ligatures | no-common-ligatures ]

<discretionary-lig-values> = [ discretionary-ligatures | no-discretionary-ligatures ]

<historical-lig-values> = [ historical-ligatures | no-historical-ligatures ]

<contextual-alt-values> = [ contextual | no-contextual ]

font-variant-numeric

normal | [ <numeric-figure-values>

<numeric-spacing-values>

<numeric-fraction-values>

ordinal

slashed-zero ]

(mPDF ≥ 6.0)

font-variant-alternates

Only [normal | historical-forms] supported (i.e. most are NOT supported)

(mPDF ≥ 6.0)

font-language-override

3-letter case-sensitive OpenType language system tag

(mPDF ≥ 6.0)

font-feature-settings

Comma separated list of <feature-tag-value> with the following syntax:

<feature-tag-value> = <string> [ <integer> | on | off ]?

(mPDF ≥ 6.0)

font-kerning

auto | normal | none (mPDF ≥ 5.1)

auto and normal both have the effect of turning kerning on, as long as

$mpdf->useKerning = true;

vertical-alignsuper | sub | baseline |LENGTH  (mPDF ≥ 5.7.3)
letter-spacingnormal |LENGTH  (mPDF ≥ 5.1)
word-spacingnormal |LENGTH  (mPDF ≥ 5.1)
colorCOLOR
text-decoration

underline | line-through | normal (line-through = strike-through)  (mPDF ≥ 5.4)

overline  (mPDF ≥ 5.7.3)

text-outline

thickness [ blur ] color; OR none (default)

Blur is not supported.

As per CSS3

(mPDF ≥ 5.7) Supported in tables ≥ 6.0

text-outline-width,outline-width

Width of the outline.LENGTH

(text-outline-width as from mPDF ≥ 5.7)

Supported in tables ≥ 6.0

text-outline-color,outline-color

COLOR  = colour of the inner part of the text e.g. #rrggbb. ‘INVERT’ is also accepted.

(text-outline-color as from mPDF ≥ 5.7) Supported in tables ≥ 6.0

text-shadowAs per CSS3 specification. `blur` is not supported.  (mPDF ≥ 5.4)
text-transform capitalize | uppercase | lowercase  (mPDF ≥ 5.4)
unicode-bidi

normal | embed | isolate | bidi-override | isolate-override | plaintext

(mPDF ≥ 6.0)

When used on block-level elements:

  • the value is not inherited to child blocks
  • usingembed orisolate has no effect on block level-boxes
  • isolate-override is equivalent tobidi-override on block-level boxes

Notes:

* Margin, padding, border-width, border-color and border-style accept the various shorthand forms e.g.:

  • margin: 1pt; will set all top, right, bottom and left values the same
  • margin: 1pt 2pt; will set top and bottom to 1pt, left and right to 2pt
  • margin: 1pt 2pt 3pt; will set top to 1 pt, left and right to 2 pt, and bottom to 3 pt (mPDF ≥ 4.0)
  • margin: 1pt 2pt 3pt 4pt; will set all values in order:top > right > bottom > left

NB Table page-break-inside, autosize values and rotate are only respected for that set on first level table of nested tables

Border

medium | thin | thick are accepted for size - converted to 1px, 3px, 5px

See Also


[8]ページ先頭

©2009-2026 Movatter.jp