The Web offers a flexible environment for designing user interfaces, as evidenced by the extreme variations in the look and feel of Web sites today. This can largely be attributed to the widespread adoption of Cascading Style Sheets ( CSS ) to format elements in an HTML document.
Web Forms pages ( .aspx files ) eventually end up as HTML pages at run time. As such, the appearance of any element on the Web Form, including server controls, can be set and manipulated using CSS. All ASP.NET HTML and Web server controls provide extensive support for CSS.
This article takes a closer look at how elements of a Web Form interact with cascading style sheets, and how you can use styles to customize the look and feel of both HTML and Web server controls, both declaratively at design time and programmatically at run time.
The following examples illustrate using CSS to enhance the appearance of ASP.NET server controls.
Now let’s explore how all these are done. The following sections assume you are familiar with the basics of cascading style sheets. If not, I suggest you get yourself a copy of the CSS Level 2 Specification, or better yet, check out this workshop’s CSS Reference.