Any style declared for a particular HTML server control is added to the collection when the containing Web Forms page is parsed. It automatically parses and exposes CSS properties through a dictionary pattern API. You can manipulate any CSS property on a server control through the Style property. Simply use the CSS property's key and value in the indexed collection.

The following code example iterates through the CssStyleCollection object for an HtmlInputText server control. The Keys property is used to determine which style attributes have been declared on the server control, and then binds the attribute names and values to a DataList object on the Web Forms page.