Text Content

HTML <var> element

Marks a variable in a mathematical expression or programming context. A variable is an identifier representing a value or placeholder, not necessarily executable JavaScript. Use code for code fragments and appropriate mathematical notation for equations. It accepts global HTML attributes; individual global features may be inapplicable or restricted.

Formal Syntax & Structure

html syntaxhtml
<var>Variable</var>

Return Value

HTMLElement

Content model: Phrasing content, with element-specific restrictions.

Working Example

Example Snippethtml
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <title>HTML example</title>  </head>  <body>    <p>      Area =      <var>width</var>      ×      <var>height</var>      .    </p>  </body></html>
HTML Reference