Class Var


@Bean(typeName="var") public class Var extends HtmlElementMixed
DTO for an HTML <var> element.

The var element represents a variable. It is used to mark up variables in mathematical expressions, programming code, or other contexts where a variable name needs to be distinguished from regular text. The var element is typically rendered in italics and is commonly used in documentation, tutorials, and technical writing to identify variable names, function parameters, or mathematical variables.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Simple variable Var simple = var("x"); // Var with styling Var styled = var("userName") ._class("variable"); // Var with complex content Var complex = var( "The variable ", strong("count"), " represents the number of items." ); // Var with ID Var withId = var("totalCount") .id("variable-name"); // Var with styling Var styled2 = var("customVariable") .style("color: #0066cc; font-style: italic;") .children("maxValue"); // Var with multiple elements Var multiple = var() .children( "The ", var().children("x"), " and ", var().children("y"), " variables are used in the equation." ); // Var with links Var withLinks = var() .children( "See ", a().href("/docs/variables").children("variable documentation"), " for more information." );

The following convenience methods are provided for constructing instances of this bean:

See Also: