ASP.NET Font Property

Definition and Usage

The Font property is used to set or return the font of the control.

Syntax

<asp:webcontrol id="id" font-subproperty="value" runat="server" />

Font Subproperty

Value Description
Bold Bold Subproperty. Possible values are: TRUE or FALSE.
Italic Italic Subproperty. Possible values are: TRUE or FALSE.
Name

Font Name Attribute (e.g., "Verdana" or "Arial").

When you set this property, update the Names property automatically through a single-element array with the value of the Name attribute.

Names

Array of font names.

When you set this property, use the first element of the array to automatically update the Name property.

Strikeout Strikeout Subproperty. Possible values are: TRUE or FALSE.
Underline Underline Subproperty. Possible values are: TRUE or FALSE.
Size Font Size Subproperty. Specifies the font size.

Example

The following example sets the font of the button control:

<form runat="server">
<asp:Button id="Button1" Text="Submit" 
Font-Name="Verdana" Font-Size="15" runat="server"/>
</form>

Example

Set the font of the button control
Set the font of the button control (with declaration and script)