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
- CSS-wide keywords:
initial,inherit,unset,revert,revert-layer,revert-rule- As the explicit defaulting keywords that roll the cascade back,
revertrolls back to the previous cascade origin,revert-layerto the layers before the current one, andrevert-ruleto the cascade without the current rule - They also work in
@pagerules and page-margin boxes, withall, with custom properties, and written as avar()fallback. See PR #2119, PR #2123
- As the explicit defaulting keywords that roll the cascade back,
- Length units:
em,ex,ch,rem,lh,rlh,vw,vh,vmin, vmax,vi,vb,cm,mm,q,in,pc,pt,px. - Sizing keywords: min-content, max-content, fit-content
- Color values
- Named Colors
transparentcolor keywordcurrentColorcolor keyword- RGB functions:
rgb(),rgba() - RGB Hexadecimal Notations: #RRGGBB, #RRGGBBAA
- HSL Colors:
hsl(),hsla() - HWB Colors:
hwb() - CMYK Colors:
device-cmyk()- Converted to
color(srgb ...)internally for browser rendering. Enables CMYK output via post-processing with Vivliostyle CLI. See PR #1627
- Converted to
- Attribute references:
attr()- Supported in property values, including the
contentproperty. - Supports
string,raw-string,url,number, and unit types, as well astype(<...>)syntax for supported CSS value types. See PR #1975 - Type and unit values are validated against the property where
attr()is used.
- Supported in property values, including the
- Cross references:
target-counter(),target-counters()andtarget-text()- Only supported in values of
contentandbookmark-labelproperties.
- Only supported in values of
string()function (Named Strings)content()functionrunning()function (Running Elements)element()function (Running Elements)leader()functioncalc()functionenv()function- Implemented only
env(pub-title)andenv(doc-title)that are not yet defined in the css-env draft spec but useful for making page header.env(pub-title): publication title = EPUB, Web publication, or primary entry page HTML title.env(doc-title): document title = HTML title, which may be chapter or section title in a publication composed of multiple HTML documents
- Implemented only
var()function
Selectors
CSS 2
- Universal selector
* - Type selectors
E - Descendant selectors
E F - Child selectors
E > F - Adjacent sibling selectors
E + F - Attribute selectors
E[foo],E[foo="bar"],E[foo~="bar"],E[foo|="bar"] - Class selectors
E.foo - ID selectors
E#foo :first-childpseudo-class- Link pseudo-class
E:link - Language pseudo-class
E:lang(c) :first-linepseudo-element:first-letterpseudo-element:beforeand:afterpseudo-elements
Not supported selectors
Selectors 3
- Type selectors with namespaces
ns|E,*|E - Universal selector with namespaces
ns|*,*|* - Substring matching attribute selectors
[att^=val],[att$=val],[att*=val] - Attribute selectors with namespaces
[ns|att],[|att],[ns|att=val],[|att=val],[ns|att~=val],[|att~=val],[ns|att|=val],[|att|=val],[ns|att^=val],[|att^=val],[ns|att$=val],[|att$=val],[ns|att*=val],[|att*=val] - The UI element states pseudo-classes
:enabled,:disabled,:checked,:indeterminate- Note that the current implementation can use only initial states of those UI elements. Even if the actual state of the element is toggled by user interaction, the style does not change.
:rootpseudo-class:nth-child()pseudo-class:nth-last-child()pseudo-class:nth-of-type()pseudo-class:nth-last-of-type()pseudo-class:first-childpseudo-class:last-childpseudo-class:first-of-typepseudo-class:last-of-typepseudo-class:only-childpseudo-class:only-of-typepseudo-class:emptypseudo-class:not()pseudo-class::first-linepseudo-element::first-letterpseudo-element::beforeand::afterpseudo-elements- General sibling combinator
E ~ F
Selectors 4
CSS Nesting 1
See PR #1889.
CSS Overflow 4
CSS Pseudo-Elements 4
CSS Generated Content for Paged Media (GCPM) 3
::footnote-callpseudo-element::footnote-markerpseudo-element- Supports
list-style-position: outsidefor placing the marker outside the footnote body. See PR #1706 - Both pseudo-elements are also supported for semantic footnotes identified by
role="doc-noteref"/role="doc-footnote"orepub:type="noteref"/epub:type="footnote". See PR #1887
- Supports
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-layerkeyword is supported. See also Values
- Both the block form (
CSS Namespaces 3
CSS Conditional Rules 3
CSS Conditional Rules 4
CSS Paged Media 3
- @page
- Page-margin boxes (@top-left-corner, @top-left, @top-center, @top-right, @top-right-corner, @left-top, @left-middle, @left-bottom, @right-top, @right-middle, @right-bottom, @bottom-left-corner, @bottom-left, @bottom-center, @bottom-right, @bottom-right-corner)
- Page selectors
- :left, :right
- :recto, :verso
- :first
- Note: In multi-document publications, the
:firstmatches only the first page of the first document, and the:nth(1)matches the first page of each document. Issue #667
- Note: In multi-document publications, the
- :blank
- Named pages (page type selector)
- Page-based counters (page, pages)
See also: Properties in CSS Paged Media 3
CSS Generated Content for Paged Media (GCPM) 3
@footnoterule (Footnote area)- Styles footnote areas with
@page { @footnote { … } } - Supports page-selector variants: e.g.,
@page :left { @footnote { … } } @footnote ::beforesupports thecontentproperty and other styles for the footnote separator@page @footnotetakes precedence over top-level@footnote- See PR #1644 and PR #1724
- Styles footnote areas with
- 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:firstmatches 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
- Vivliostyle uses styles specified for
printmedia (as well asall).- Vivliostyle specific media type
vivliostyleis enabled in addition toprintmedia.
- Vivliostyle specific media type
- Supported media features
Properties
CSS 2
- background
- Supports CSS Backgrounds 3 syntax
- background-attachment
- Supports CSS Backgrounds 3 syntax
- background-color
- Supports CSS Backgrounds 3 syntax
- background-image
- Supports CSS Backgrounds 3 syntax
- background-position
- Supports CSS Backgrounds 3 syntax
- background-repeat
- Supports CSS Backgrounds 3 syntax
- border
- border-bottom
- border-bottom-color
- border-bottom-style
- border-bottom-width
- border-collapse
- border-color
- border-left
- border-left-color
- border-left-style
- border-left-width
- border-right
- border-right-color
- border-right-style
- border-right-width
- border-spacing
- border-style
- border-top
- border-top-color
- border-top-style
- border-top-width
- border-width
- bottom
- caption-side
- clear
- See also CSS Page Floats
- clip
- color
- content
- counter-increment
- counter-reset
- counter-set
- cursor
- direction
- display
- empty-cells
- float
- See also CSS Page Floats
- font
- font-family
- font-size
- font-style
- font-variant
- Supports CSS Fonts 3 font-variant
- font-weight
- height
- left
- letter-spacing
- line-height
- list-style
- list-style-image
- list-style-position
- list-style-type
- margin
- margin-bottom
- margin-left
- margin-right
- margin-top
- max-height
- max-width
- min-height
- min-width
- orphans
- outline
- outline-color
- outline-offset
- outline-style
- outline-width
- overflow
- padding
- padding-bottom
- padding-left
- padding-right
- padding-top
- page-break-after
- page-break-before
- page-break-inside
- position
- quotes
- Also supported in
@pagerules and page-margin boxes. See PR #2290 autouses default quotation marks rather than selecting them based on the content language.
- Also supported in
- right
- table-layout
- text-align
- text-decoration
- text-indent
- text-transform
- top
- unicode-bidi
- vertical-align
- visibility
- white-space
- widows
- width
- word-spacing
- z-index
CSS Paged Media 3
- bleed
- Only effective when specified within an
@pagerule without page selectors
- Only effective when specified within an
- marks
- Only effective when specified within an
@pagerule without page selectors
- Only effective when specified within an
- size
- page-orientation
- Supports
upright,rotate-left, androtate-right. Rotation is applied after layout in print output in Chromium and Firefox; pages are displayed unrotated in the viewer. See PR #2292
- Supports
- 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
- string-set (Named Strings)
- position: running() (Running Elements)
- footnote-display
- Supports
block,inline,compactvalues. - Also applies to semantic footnotes. See PR #1887
- Supports
- footnote-policy
- Supports
auto,linevalues. - Also applies to semantic footnotes. See PR #1887
- Supports
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-statesets whether the entry is initially expanded in the TOC box, and is returned as thestateof the entry bygetTOC().- Note: Bookmarks on
::beforeand::afterpseudo-elements are not supported. Inbookmark-label, a cross reference to a target that has not been laid out yet is shown as??.
- The bookmarks generate the table of contents shown in the TOC box of the viewer and returned by
CSS Fragmentation 3
- break-after
- break-before
- break-inside
- Note: All of
avoid-page,avoid-columnandavoid-regionvalues are treated as if they wereavoid. Issue #128
- Note: All of
- orphans
- widows
- box-decoration-break
- Note: Background, box-shadow and border images on inline-start/end borders are always rendered as if
box-decoration-break: cloneis specified.
- Note: Background, box-shadow and border images on inline-start/end borders are always rendered as if
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, andregionvalues. - When
allis 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
clearvalue is specified on a page float, it is placed so that it comes after any of preceding page floats. samevalue means the same direction as one which the page float is floated to.- If a page float with
float: snap-blockwould be placed at the block-start end but aclearvalue on it forbidden such placement, the float is instead placed at the block-end side (unless theclearvalue also forbidden such placement). - The
page,column, andregionvalues ensure that preceding page floats are placed before the page/column/region containing the element that has theclearproperty, 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.
- Supports
- float
- Supports
block-start,block-end,inline-start,inline-end,snap-block,left,right,top,bottomandnonevalues. - Supports values combining keywords. For example,
float: top right;float to top right cornerfloat: bottom left;float to bottom left cornerfloat: top bottom;float to top or bottom edgefloat: top bottom left;float to top left or bottom left cornerfloat: top bottom left right;float to top left, top right, bottom left, or bottom right cornerfloat: block-start inline-start;float to block-start and inline-start cornerfloat: block-start block-end;float to block-start or block-end edge (same as 'snap-block')- See PR #1444
- Supports
- float-reference
- Specify
float-reference: page(orcolumn/region) to enable page (or column/region) float.
- Specify
- 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
- background
- background-attachment
- background-clip
- background-color
- background-image
- background-origin
- background-position
- background-repeat
- background-size
- border
- border-bottom
- border-bottom-color
- border-bottom-left-radius
- border-bottom-right-radius
- border-bottom-style
- border-bottom-width
- border-color
- border-image
- border-image-outset
- border-image-repeat
- border-image-slice
- border-image-source
- border-image-width
- border-left
- border-left-color
- border-left-style
- border-left-width
- border-radius
- border-right
- border-right-color
- border-right-style
- border-right-width
- border-style
- border-top
- border-top-color
- border-top-left-radius
- border-top-right-radius
- border-top-style
- border-top-width
- border-width
- box-shadow
CSS Images 3
- object-fit
- object-position
- image-resolution
- Only
<resolution>value is supported. - Only supported for content of
img,input[type=image]andvideo(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.
- Only
CSS Fonts 3
- font-family
- font-feature-settings
- font-kerning
- font-size
- font-style
- font-variant
- font-variant-ligatures
- font-variant-caps
- font-variant-numeric
- font-variant-east-asian
- font-weight
- font-stretch
See also: At-rules in CSS Fonts 3
CSS Text 3
- hanging-punctuation
- Supports all required values,
none | [ first || [ force-end | allow-end ] || last ]. See PR #814
- Supports all required values,
- hyphens
- letter-spacing
- line-break
- overflow-wrap, word-wrap
- tab-size
- text-align-last
- Note: While
text-alignproperty is a shorthand in CSS Text 3, Vivliostyle treatstext-alignfor now as an independent property (defined in CSS 2.1) rather than a shorthand.
- Note: While
- white-space
- word-break
CSS Text 4
- text-autospace
- Supported values:
normal | no-autospace | [ ideograph-alpha || ideograph-numeric ] | auto - The browser's native
text-autospaceis 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-autospaceandtext-spacing-trimapply.
- Supported values:
- text-spacing-trim
- Values:
space-all | normal | space-first | trim-start | trim-both | trim-all | auto - The browser's native
text-spacing-trimis 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 fortrim-both, andhanging-punctuation. Otherwise, Vivliostyle's own implementation is used throughout the inline formatting context. See Issue #2151. trim-allis 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).
- Values:
- text-spacing
- Values:
normal | none | auto | [<autospace> || <spacing-trim>] - Note: This is a shorthand property that sets the
text-autospaceandtext-spacing-trimproperties. See PR #1142
- Values:
CSS Text Decoration 3
- text-decoration-color
- text-decoration-line
- text-decoration-style
- text-emphasis
- In Chromium, excess block-start leading can be reduced on the first line of a page or root column, under the same first-line, border and formatting-context conditions as ruby. The target block must also have zero block-start margin and padding, and the emphasized text must have a numeric computed
line-heightrather thannormal. Firefox and WebKit retain their native emphasis layout. In WebKit, emphasis can increase line spacing within a paragraph; this remains a limitation. End-side emphasis can also leave fewer lines in a page or column. See Issue #1604.
- In Chromium, excess block-start leading can be reduced on the first line of a page or root column, under the same first-line, border and formatting-context conditions as ruby. The target block must also have zero block-start margin and padding, and the emphasized text must have a numeric computed
- text-emphasis-color
- text-emphasis-position
- text-emphasis-style
- text-shadow
- text-underline-position
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: columnin the CSS Page Floats feature is only supported for root multicol.- Limitation:
column-span: allis 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
-
- Note: In root multicol,
column-spanis effective only when specified on a page float. Whenautovalue 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: allcan be used without restrictions.
- Note: In root multicol,
CSS Basic User Interface 3
CSS Writing Modes 3
- direction
- text-combine-upright
- text-orientation
- unicode-bidi
- writing-mode
- Supports
horizontal-tb,vertical-rl,vertical-lr,sideways-rl, andsideways-lr.
- Supports
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 !importantonrtor an element withdisplay: ruby-text. Nonzero author margins are respected.
Compositing and Blending 1
Scalable Vector Graphics (SVG) 2
- color-interpolation
- color-rendering
- fill
- fill-opacity
- fill-rule
- glyph-orientation-vertical
- image-rendering
- marker
- marker-start
- marker-mid
- marker-end
- pointer-events
- paint-order
- shape-rendering
- stop-color
- stop-opacity
- stroke
- stroke-dasharray
- stroke-dashoffset
- stroke-linecap
- stroke-linejoin
- stroke-miterlimit
- stroke-opacity
- stroke-width
- text-anchor
- text-rendering
- vector-effect
Scalable Vector Graphics (SVG) 1.1
CSS Masking 1
Filter Effects 1
Pointer Events
CSS Logical Properties and Values 1
- block-size, inline-size, min-block-size, min-inline-size, max-block-size, max-inline-size
- margin-block-start, margin-block-end, margin-inline-start, margin-inline-end, margin-block, margin-inline
- inset-block-start, inset-block-end, inset-inline-start, inset-inline-end, inset-block, inset-inline
- padding-block-start, padding-block-end, padding-inline-start, padding-inline-end, padding-block, padding-inline
- border-block-start-width, border-block-end-width, border-inline-start-width, border-inline-end-width, border-block-width, border-inline-width, border-block-start-style, border-block-end-style, border-inline-start-style, border-inline-end-style, border-block-style, border-inline-style, border-block-start-color, border-block-end-color, border-inline-start-color, border-inline-end-color, border-block-color, border-inline-color, border-block-start, border-block-end, border-inline-start, border-inline-end, border-block, border-inline
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
- -epubx-conflicting-partitions
- -epubx-enabled
- -epubx-flow-consume
- -epubx-flow-from
- Only effective when specified to EPUB Adaptive Layout partitions.
- -epubx-flow-into
- -epubx-flow-linger
- -epubx-flow-options
- -epubx-flow-priority
- -epubx-min-page-height
- -epubx-min-page-width
- -epubx-required
- -epubx-required-partitions
- -epubx-shape-outside
- Only effective when specified to EPUB Adaptive Layout partitions.
- Note: only old syntaxes from 3 May 2012 Working Draft are supported.
- -epubx-shape-inside
- Only effective when specified to EPUB Adaptive Layout partitions.
- Note: only old syntaxes from 3 May 2012 Working Draft are supported.
- -epubx-snap-height
- -epubx-snap-width
- -epubx-text-zoom
- -epubx-utilization
- -epubx-wrap-flow
- Only effective when specified to EPUB Adaptive Layout partitions.