-
-
Notifications
You must be signed in to change notification settings - Fork 189
CSS
The .css
[docs] function makes it possible to apply CSS styles to the document.
Warning
CSS styles are applied only in HTML (and HTML-PDF) documents, and won't have any effect in other future targets.
This topic is thoroughly covered in the HTML page.
.css
body {
background-color: green !important;
}
h1 {
color: pink !important;
}
CSS styles can also be loaded from file by means of the .read
function:
.css {.read {styles.css}}
Note
Contrary to what happens with, for example, .code
, .css
does not allow
function calls inside the body argument, since they would be ambiguous with the
CSS syntax.
For this reason the call to .read
must be inlined, as in the previous example.
If the purpose is to override Quarkdown's default style, then the suggested approach is to take advantage of the .cssproperties
[docs] function.
This function takes a dictionary of strings, where each item is a --qd-*
CSS property and value pair.
Why is this preferred over
.css
?Quarkdown's themes use properties for more granular control and easier overrides. For instance, the same property may be applied differently depending on the document type.
For context, when calling functions such as
.pageformat
or.paragraphstyle
, their effects are applied by injecting the corresponding--qd-*
properties.Overriding a
--qd-*
property rather than its raw CSS equivalent allows for a smoother control and reduces the risk of future breaking changes.
.cssproperties
- background-color: green
- heading-color: pink
- block-margin: 12px
A complete list of available properties can be found in the global theme.
Unknown properties are safely ignored.
- Figures
- Image size
- TeX formulas
- Table caption
- Decorative headings
- Alerts (quote types)
- Quotation source
- Page breaks
- Text symbols (text replacement)
- Syntax of a function call
- Declaring functions
- Dynamic typing
- Including other Quarkdown files
- Importing external libraries
- Localization
- Document metadata
- Theme
- CSS
- Fonts
- Page format
- Page margin content
- Page counter
- Automatic page break
- Numbering
- Paragraph style
- Caption position
- Table of contents
- Bibliography
- Stacks (row, column, grid)
- Container
- Align
- Float
- Figure
- Clip
- Box
- Collapsible
- Whitespace
- Variables
- Optionality
- Math
- Conditional statements
- Loops
- Let
- Destructuring
- String manipulation
- Table manipulation: sorting, computing, and more
- Generators
- String
- Number
- Markdown content
- Boolean
- None
- Enumeration entry
- Iterable
- Dictionary
- Range
- Lambda
- Size(s)
- Color
- Dynamic
- Paper: abstract, definitions, theorems, and more