CKTIS / HTML
var — semantic variable markup
The var element marks a variable, parameter, constant, physical quantity, or placeholder in prose. It does not declare JavaScript variables.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
<var>variable</var>var represents a variable in mathematics, programming, or prose, including a parameter, constant identifier, or physical-quantity symbol.
It is flow, phrasing, and palpable content. It is allowed wherever phrasing content is expected and accepts phrasing content. Both tags are required; global attributes are supported.
Do not confuse it with the JavaScript keyword var: it neither declares nor evaluates values. Use code for code fragments. Prefer MathML for more complex mathematics; var can mark variables discussed alongside a formula.
Examples
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Variable example</title>
</head>
<body>
<p><var>x</var> + 2 = 5; <var>x</var> = 3.</p>
</body>
</html>Result
x + 2 = 5; x = 3.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.