| Depr. | Empty | Version |
|---|---|---|
| No | No | HTML 2 |
| IE5.5+ | FF1+ | SA1.3+ | OP9.2+ | CH2+ |
|---|---|---|---|---|
| Full | Full | Full | Full | Full |
Syntax
Description
The
var element is used to indicate that the text is a
variable and shouldn’t be taken literally. Instead, it’s a placeholder
where the contents should be replaced with your own value.
The example code would render as shown in Figure 1.
var
Example
The following example shows a typical instruction about how to use a telephone system:
<p>To forward incoming calls to another extension, press <kbd>* 21 * <var>extension</var> #</kbd>.</p>
Use This For …
This element is used to indicate that the phrase is a variable of some kind—most likely in the context of showing an example value, as illustrated in the example HTML above.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 8.0 | 1.0 | 1.5 | 2.0 | 3.0 | 3.5 | 1.3 | 2.0 | 3.1 | 4.0 | 9.2 | 9.5 | 10.0 | 2.0 |
| Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full |
The var has good browser support; with all of
the major browsers rendering the variable text in italics (similar to
other reference-type phrase elements, such as cite and dfn).
User-contributed notes
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.