The HTML spec for var states:
The var element represents a variable. This could be an actual
variable in a mathematical expression or programming context, an
identifier representing a constant, a function parameter, or just be a
term used as a placeholder in prose.
For me this means that <var>
is not suitable for the prices in your examples. It depends on what you are trying to accomplish, but it seems your options are:
- Use microdata (ref), for example Schema.org’s
offer
vocabulary for a product’s price
- Use
<b>
if you’d like to draw attention to the price without indicating it’s more important (ref)
- Use
<strong>
if the price is important, such as the total price of an itemised receipt
- Use
<span>
with a class if you need an element to style the price differently, but <b>
and <strong>
are not appropriate
- If nothing above is suitable and you don’t want to style the price, don’t do anything
From the examples you’ve given there doesn’t seem to be any need to mark up prices. If the examples are from a table to display financial information, make sure they’re in a column headed by <th scope="col">Income</th>
or <th scope="col">Price</th>
respectively for accessibility.
Hope that helps!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…