StealThis .dev

Science — Equation Block

A KaTeX-style display equation block rendered entirely in HTML and CSS with no math libraries. It typesets four numbered equations from a fictional two-box climate model — stacked fractions with a real rule, summation and integral glyphs with limits, Greek letters, subscripts and superscripts, and right-aligned equation numbers. Inline math sits inside the prose, hovering a reference button highlights its display block, and a per-equation copy action reveals and copies the LaTeX source. A calibrated-parameters table rounds out the article.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

Equation Block

A typeset article page that renders four display equations the way a math library would, but using only semantic HTML and CSS — no KaTeX, MathJax, or any external dependency. Fractions are built as stacked numerator and denominator boxes separated by a real horizontal rule, summation and integral signs carry their upper and lower limits in mono, and variables are set in italic serif while operators and units fall back to monospace. Each block reserves space on the right for a classic equation number — (1), (2), (3), (4).

The interactions tie the prose to the figures. Inline math appears mid-sentence, and every reference such as Eq. (1) is a real button: hover or focus it and the matching display block lights up; click it and the page scrolls smoothly to the equation with a brief pulse. The relationship runs both ways — hovering an equation block highlights the reference buttons that point at it.

Every equation also offers a Copy LaTeX control that appears on hover. Activating it copies the source to the clipboard, reveals the underlying LaTeX in an inline code panel, and confirms with a toast. The page is keyboard-usable with visible focus rings, the parameters table scrolls horizontally on narrow screens, and the whole layout reflows to a single column with bottom-anchored equation numbers down to 360px.

Illustrative UI only — fictional authors, data, and figures; not real scientific results.