ASP.NET CssClass Property

Definition and Usage

The CssClass property is used to return a CSS class style to the control.

Syntax

<asp:webcontrol id="id" CssClass="style" runat="server" />
Property Description
style String value, which specifies the CSS class used on the control.

Example

This example sets CSS styles for the button:

<style>
.TestStyle
  { 
  font: 12pt verdana; 
  font-weight:700; 
  color:orange;
  }
</style>
<form runat="server">
<asp:Button id="Button" CssClass="TestStyle" 
Text="Submit" runat="server"/>
</form>

Example

Add Styles to Buttons Using CssClass