[Implementers’ doc] [Authors’ info]
Readium CSS is leveraging the cascade in order to provide authors with defaults, paginate contents and apply user overrides and themes. As a consequence, there is a specific order in which reflowable stylesheets must be added. Indeed, conformance with CSS Cascading and Inheritance Level 3 requires that we make authors’ stylesheets an integral part of our cascade.
Inject ReadiumCSS dist
stylesheets into the <head>
of (X)HTML documents.
ReadiumCSS-before.css
- Authors’ stylesheet(s) or
ReadiumCSS-default.css
for unstyled publications ReadiumCSS-after.css
For RTL, you would then have to load the stylesheets in the rtl
folder. Same for CJK. Check the “Internationalization” doc for guidance.
By default, we inject all stylesheets on load and rely on custom properties (a.k.a. CSS variables) set on html
to apply user settings.
If you want to customize dist
stylesheets, you’ll have to respect the following guidelines and rebuild dist
stylesheets.
The following modules must be inserted before the author’s stylesheets (ReadiumCSS-before.css
), in this exact order:
ReadiumCSS-config.css
ReadiumCSS-base.css
ReadiumCSS-day_mode.css
ReadiumCSS-fonts.css
ReadiumCSS-html5patch.css
ReadiumCSS-safeguards.css
(orReadiumCSS-safeguards-vertical.css
for CJK – vertical writing mode)
The following modules must be appended if there is no external stylesheet (<link>
), internal stylesheet (<style>
) or inline styles in the document (style=" "
), in this exact order:
ReadiumCSS-default.css
This default must be appended before all other modules in the next section.
The following modules must be appended after the author’s stylesheets (ReadiumCSS-after.css
), ideally in this order:
ReadiumCSS-config.css
ReadiumCSS-pagination.css
(orReadiumCSS-pagination-vertical.css
for CJK – vertical writing mode)ReadiumCSS-scroll.css
(orReadiumCSS-scroll-vertical.css
for CJK – vertical writing mode)ReadiumCSS-night_mode.css
ReadiumCSS-sepia_mode.css
ReadiumCSS-theming.css
ReadiumCSS-os_a11y.css
- User settings:
ReadiumCSS-colNumber_pref.css
(does not apply to CJK – vertical writing mode)ReadiumCSS-lineLength_pref.css
(orReadiumCSS-lineLength-vertical_pref.css
for CJK – vertical writing mode)ReadiumCSS-customColors_pref.css
ReadiumCSS-textAlign_pref.css
(does not apply to CJK scripts)ReadiumCSS-bodyHyphens_pref.css
(does not apply to CJK scripts)ReadiumCSS-fontFamily_pref.css
ReadiumCSS-a11yFont_pref.css
(does not apply to RTL and CJK scripts)ReadiumCSS-fontSize_pref.css
ReadiumCSS-lineHeight_pref.css
ReadiumCSS-paraSpacing_pref.css
(orReadiumCSS-paraSpacing-vertical_pref.css
for CJK – vertical writing mode)ReadiumCSS-paraIndent_pref.css
(does not apply to CJK scripts)ReadiumCSS-wordSpacing_pref.css
(does not apply to CJK scripts)ReadiumCSS-letterSpacing_pref.css
(does not apply to RTL scripts, except in vertical writing mode)ReadiumCSS-arabicLigatures_pref.css
(RTL only)ReadiumCSS-variableFont_pref.css
(this contains optical sizing, weight and width prefs)ReadiumCSS-ruby_pref.css
(CJK only)ReadiumCSS-imageFilters_pref.css
ReadiumCSS-fs_normalize.css