The keys in the caption category control the arrangement and style of block captions globally. Many of these keys can be customized per block.

caption

Tip
The caption-align and caption-text-align keys on the image and table categories also accept the value inherit. See block-images.html and tables.html for more information about setting inherit on their captions.
Key Value Type Example

align

Block alignment
(default: left)

caption:
  align: right

background-color

Color
(default: not set)

caption:
  background-color: #DDDDDD

end

top | bottom
(default: varies by block)

caption:
  end: bottom

font-color

Color
(default: inherit)

caption:
  font-color: #333333

font-family

Font family name
(default: inherit)

caption:
  font-family: M+ 1mn

font-kerning

none | normal
(default: inherit)

caption:
  font-kerning: none

font-size

Font size
(default: inherit)

caption:
  font-size: 11

font-style

Font style
(default: italic)

caption:
  font-style: italic

margin-inside

Measurement
(default: 4)

caption:
  margin-inside: 3

margin-outside

Measurement
(default: 0)

caption:
  margin-outside: 0

text-align

Text alignment
(default: $<category>-caption-align or $caption-align)

caption:
  text-align: right

text-decoration

Text decoration
(default: none)

caption:
  text-decoration: line-through

text-decoration-color

Color
(default: $caption-font-color)

caption:
  text-decoration-color: #FF0000

text-decoration-width

Number
(default: $base-text-decoration-width)

caption:
  text-decoration-width: 0.5

text-transform

Text transform
(default: inherit)

caption:
  text-transform: uppercase

Caption per block

In addition to the global caption category, each of the keys listed in caption, except for the text-decoration keys, can be set on the caption key nested inside the following block categories:

  • code

  • description-list

  • example

  • footnotes

  • image

  • list (applies to ulist and olist)

  • quote

  • table

  • verse

For example, to configure the caption just for code blocks, use the following declaration:

code:
  caption:
    background-color: #FF0000
    font-color: #FFFFFF
    font-size: 1em
    font-style: bold

If a key is not specified on a block category, the key from the global caption category will be used as a fallback.