English|日本語

Supported CSS Features

Vivliostyle currently supports the following CSS values, selectors, at-rules, media queries, and properties:

In addition, essentially all CSS properties and values supported by the browser are available, since Vivliostyle.js lets the browser handle CSS properties that Vivliostyle.js does not handle on its own.

Values

Selectors

CSS 2

Not supported selectors

Selectors 3

Selectors 4

CSS Nesting 1

See PR #1889.

  • Nested style rules, including implicit descendant nesting and the & nesting selector
  • Nested @media, @supports, @layer, and @-epubx-when rules. See also PR #2109
  • Only at-rules already supported by Vivliostyle are supported when nested

CSS Overflow 4

CSS Pseudo-Elements 4

CSS Generated Content for Paged Media (GCPM) 3

Not supported selectors

At-rules

CSS 2

CSS Cascading and Inheritance 5

  • @layer
    • Both the block form (@layer name { … }, @layer { … }) and the statement form (@layer a, b;) are supported, as well as @import … layer / @import … layer(name).
    • The revert-layer keyword is supported. See also Values

CSS Namespaces 3

CSS Conditional Rules 3

CSS Conditional Rules 4

CSS Paged Media 3

See also: Properties in CSS Paged Media 3

CSS Generated Content for Paged Media (GCPM) 3

  • @footnote rule (Footnote area)
    • Styles footnote areas with @page { @footnote { … } }
    • Supports page-selector variants: e.g., @page :left { @footnote { … } }
    • @footnote ::before supports the content property and other styles for the footnote separator
    • @page @footnote takes precedence over top-level @footnote
    • See PR #1644 and PR #1724
  • Nth page selector :nth(An+B [of <custom-ident>])
    • :nth(An+B of <page-type>) is page-group-aware, matching against all active page groups on the current page. See PR #1745
    • Note: In multi-document publications, the :nth(1) matches the first page of each document, but the :first matches only the first page of the first document. Issue #667

See also:

CSS Fonts 3

See also: Properties in CSS Fonts 3

CSS Counter Styles 3

Media queries

Properties

CSS 2

CSS Paged Media 3

  • bleed
    • Only effective when specified within an @page rule without page selectors
  • marks
    • Only effective when specified within an @page rule without page selectors
  • size
    • Supports all required values and proposed values A0-A10, B0-B10, C0-C10 and JIS-B0-JIS-B10. See PR #713
    • Chromium prints mixed page sizes using each page's specified size. Firefox prints them on sheets of one size, turned to each page's orientation. See PR #2292
  • page-orientation
    • Supports upright, rotate-left, and rotate-right. Rotation is applied after layout in print output in Chromium and Firefox; pages are displayed unrotated in the viewer. See PR #2292
  • crop-offset
    • Specifies distance between the edge of the trim size and the edge of the output page media size
    • This property is not standardized yet. See Issue #913
  • crop-marks-line-color
    • Specifies color of the crop marks
    • This property is not standardized yet. See PR #1505
  • page (Named Pages)

See also: At-rules in CSS Paged Media 3

CSS Generated Content for Paged Media (GCPM) 3

See also:

CSS Generated Content 3

  • bookmark-level, bookmark-label, bookmark-state (Bookmarks)
    • The bookmarks generate the table of contents shown in the TOC box of the viewer and returned by getTOC(), which Vivliostyle CLI uses for PDF bookmarks. See PR #2258
    • A navigation document specified in the EPUB package document or in the publication manifest takes precedence over the CSS bookmarks.
    • bookmark-state sets whether the entry is initially expanded in the TOC box, and is returned as the state of the entry by getTOC().
    • Note: Bookmarks on ::before and ::after pseudo-elements are not supported. In bookmark-label, a cross reference to a target that has not been laid out yet is shown as ??.

CSS Fragmentation 3

CSS Fragmentation 4

CSS Page Floats

  • clear
    • Supports none, inline-start, inline-end, block-start, block-end, left, right, top, bottom, both, all, same, page, column, and region values.
    • When all is specified on a block-level box (not a page float), the block-start edge of the box gets pushed down so that the edge comes after any block-start/block-end page float of which anchors are before the box in the document order.
    • When a clear value is specified on a page float, it is placed so that it comes after any of preceding page floats.
    • same value means the same direction as one which the page float is floated to.
    • If a page float with float: snap-block would be placed at the block-start end but a clear value on it forbidden such placement, the float is instead placed at the block-end side (unless the clear value also forbidden such placement).
    • The page, column, and region values ensure that preceding page floats are placed before the page/column/region containing the element that has the clear property, which can be a page float, a normal float, or a block-level box. These values are supported as extensions to the current CSS Page Floats draft. See Issue #1551.
  • float
    • Supports block-start, block-end, inline-start, inline-end, snap-block, left, right, top, bottom and none values.
    • Supports values combining keywords. For example,
      • float: top right; float to top right corner
      • float: bottom left; float to bottom left corner
      • float: top bottom; float to top or bottom edge
      • float: top bottom left; float to top left or bottom left corner
      • float: top bottom left right; float to top left, top right, bottom left, or bottom right corner
      • float: block-start inline-start; float to block-start and inline-start corner
      • float: block-start block-end; float to block-start or block-end edge (same as 'snap-block')
      • See PR #1444
  • float-reference
    • Specify float-reference: page (or column/region) to enable page (or column/region) float.
  • float-min-wrap-block
    • Applies to a page float
    • A percentage value is respect to the block dimension of the float reference of the page float
    • When set to a positive length, in-flow contents are not allowed to be flown into a space next to the page float if the block extent of the space is less than the specified length. In that case, the space is kept empty and the in-flow contents are deferred to the next column.
    • This property is not standardized yet. See PR #382

CSS Color 3

See also: Values - Supported color values

CSS Backgrounds and Borders 3

CSS Images 3

  • object-fit
  • object-position
  • image-resolution
    • Only <resolution> value is supported.
    • Only supported for content of img, input[type=image] and video (applied to poster images) elements and before/after pseudoelements. Other images such as background images, list images or border images are not supported.
    • The property is applied to vector images such as SVG, as well as raster images. This behavior is different from what the spec specifies.

CSS Fonts 3

See also: At-rules in CSS Fonts 3

CSS Text 3

CSS Text 4

  • text-autospace
    • Supported values: normal | no-autospace | [ ideograph-alpha || ideograph-numeric ] | auto
    • The browser's native text-autospace is used for the text within an element where the browser supports the value. Otherwise, and at element boundaries, where browsers behave differently, Vivliostyle's own implementation is used. At element boundaries, the spacing is determined by the innermost element containing the boundary, as defined in CSS Text 4. See Issue #2151.
    • In SVG, the browser's default values of text-autospace and text-spacing-trim apply.
  • text-spacing-trim
    • Values: space-all | normal | space-first | trim-start | trim-both | trim-all | auto
    • The browser's native text-spacing-trim is used where the browser supports it (currently Chromium) and the fonts used can trim all the punctuation in the inline formatting context. Vivliostyle's own implementation is used together with it for the behavior the browser does not provide, such as setting fullwidth closing punctuation half-width at the end of a line for trim-both, and hanging-punctuation. Otherwise, Vivliostyle's own implementation is used throughout the inline formatting context. See Issue #2151.
    • trim-all is always processed by Vivliostyle's own implementation, since browsers do not support it. Fullwidth colon punctuation (:;) is treated as fullwidth middle dot punctuation except in Simplified Chinese, and fullwidth dot punctuation (、。,.) only in Traditional Chinese. See Issue #2214.
    • In vertical text, Vivliostyle's own implementation does not trim the fullwidth colon punctuation other than the fullwidth colon (:) in Japanese, since it is usually not rotated, unless the text is set sideways (e.g., text-orientation: sideways).
  • text-spacing
    • Values: normal | none | auto | [<autospace> || <spacing-trim>]
    • Note: This is a shorthand property that sets the text-autospace and text-spacing-trim properties. See PR #1142

CSS Text Decoration 3

CSS Inline Layout 3

CSS Multi-column 1

Vivliostyle supports CSS multi-column layout, but the behavior differs depending on whether it is specified on the root/body element or on other elements:

  • Root multicol (specified on the root or body element):

    • If both the root element and the body element have multi-column specified, only the root element's multi-column is treated as root multicol.
    • The page area becomes the multi-column container.
    • Implemented independently by Vivliostyle, not dependent on the browser's multi-column implementation.
    • float-reference: column in the CSS Page Floats feature is only supported for root multicol.
    • Limitation: column-span: all is only supported for page floats in root multicol.
  • Non-root multicol (specified on elements other than root/body):

    • Multi-column processing depends on the browser's multi-column implementation.
    • Allows mixing multiple multi-column containers with different column counts on the same page, nesting multi-column layouts inside each other, and spanning elements across all columns with column-span: all.
    • Note: Since this relies on the browser's multi-column implementation, when using Vivliostyle.js with Safari/WebKit, nested multi-column layouts may be broken or page breaking inside non-root multi-column boxes may not work well due to known WebKit bugs. See Issue #1821
  • column-count

  • column-gap

  • column-rule

  • column-rule-color

  • column-rule-style

  • column-rule-width

  • column-width

  • columns

  • column-fill

  • column-span

    • Note: In root multicol, column-span is effective only when specified on a page float. When auto value is specified, either a single column or all columns are spanned depending on the min-content inline size of the page float.
    • In non-root multicol, column-span: all can be used without restrictions.

CSS Basic User Interface 3

CSS Writing Modes 3

CSS Flexible Box 1

CSS Transforms 1

CSS Ruby Layout 1

As with other CSS features, all ruby-related properties and values supported by the browser are available. Ruby positioning and ordinary line spacing follow the browser's layout.

The line-spacing adjustment below applies to HTML ruby and simple CSS ruby using display: ruby, ruby-base and ruby-text, when the ruby has a numeric computed line-height rather than normal. In WebKit, eligible CSS ruby is limited to span elements with these display values.

Line-spacing adjustment (Issue #1604):

  • Chromium and WebKit can reduce excess block-start leading only on the first line of a page or root column, within the document's root block formatting context and without a block-start border on the target block or its enclosing content boxes. Page-box borders do not affect this adjustment. Firefox retains its native ruby margins.
  • Separate formatting contexts, including non-root columns, are outside this adjustment's scope. WebKit ruby and Chromium horizontal under ruby can still add paragraph-boundary spacing; end-side annotations can also leave fewer lines in a page or column. Spacing needed to prevent opposing over/under annotations from overlapping is preserved.
  • Normal zero margins, including universal resets, do not disable the adjustment. To keep native leading, specify margin-block-start: 0 !important on rt or an element with display: ruby-text. Nonzero author margins are respected.

Compositing and Blending 1

Scalable Vector Graphics (SVG) 2

Scalable Vector Graphics (SVG) 1.1

CSS Masking 1

Filter Effects 1

Pointer Events

CSS Logical Properties and Values 1

Page spread inside/outside properties and values

In these properties and values, the inside and outside keywords resolve to left and right depending on whether the page is left or right page.

Note: These CSS properties and values are not standardized yet. See PR #1519

Added *-inside/outside properties:

  • margin-inside, margin-outside
  • padding-inside, padding-outside
  • border-inside, border-outside
  • border-inside-color, border-outside-color
  • border-inside-style, border-outside-style
  • border-inside-width, border-outside-width
  • inset-inside, inset-outside

Extended properties with inside and outside values:

  • float, clear
  • text-align, text-align-last

CSS Repeated Headers and Footers

Note: This spec proposal is not submitted to CSS Working Group yet.

Semantic Footnotes (role / epub:type attributes)

Vivliostyle supports footnotes using semantic attributes on HTML elements, in addition to CSS GCPM float: footnote property. Footnote references and footnote content are identified by role attributes (DPUB-ARIA) or epub:type attributes (EPUB 3 Structural Semantics Vocabulary).

  • Footnote reference: <a role="doc-noteref" href="#fn1">1</a> or <a epub:type="noteref" href="#fn1">1</a>
  • Footnote content: <aside role="doc-footnote" id="fn1">Footnote text</aside> or <aside epub:type="footnote" id="fn1">Footnote text</aside>

See Issue #1700

EPUB Adaptive Layout

Note: This spec is not on a W3C standards track. Future version of Vivliostyle may drop support for this spec.

At-rules

Properties