Skip to content

Code

code, pre, kbd, samp and var, styled with no class.

Inline code

Inline code wraps with the text. Each wrapped line keeps its own padding and corners.

Run npm run build and open dist/index.html.

Code block

Put code inside pre for a block that keeps line breaks and scrolls sideways.

:root {
  --i-color-primary: #7c3aed;
}

Keyboard

Nest kbd elements for a key combination. The outer one stays plain.

Press Esc to close, or Ctrl + C to copy.

Sample and variable

samp shows program output. var names a variable and keeps the text font.

The build prints Built 57 pages into dist.

The area is width times height.

Light

Code is dark in both themes. .light switches it to light colors.

Set data-theme on any element.

<html data-theme="dark">

Rounded and square

.rounded and .square

Variables

VariableDefault
--i-code-font-familyvar(--i-font-mono)
--i-code-font-size0.85em
--i-code-padding-block0.125rem
--i-code-padding-inline0.35rem
--i-kbd-font-weightbolder
--i-code-color-textlight-dark(var(--i-color-slate-200), #8891a4)
--i-code-color-backgroundlight-dark(var(--i-color-slate-700), #1a1f28)
--i-kbd-color-textlight-dark(var(--i-code-color-text), var(--i-color-background))
--i-kbd-color-backgroundlight-dark(var(--i-code-color-background), var(--i-color-text))
--i-code-light-color-textvar(--i-color-slate-700)
--i-code-light-color-backgroundvar(--i-color-slate-200)