Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
HtmlTextWriterStyle Enumeration
Collapse the table of content
Expand the table of content

HtmlTextWriterStyle Enumeration

Specifies the HTML styles available to an HtmlTextWriter or Html32TextWriter object output stream.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public enum HtmlTextWriterStyle

Member nameDescription
BackgroundColorSpecifies the HTML backgroundcolor style.
BackgroundImageSpecifies the HTML backgroundimage style.
BorderCollapseSpecifies the HTML bordercollapse style.
BorderColorSpecifies the HTML bordercolor style.
BorderStyleSpecifies the HTML borderstyle style.
BorderWidthSpecifies the HTML borderwidth style.
ColorSpecifies the HTML color style.
CursorSpecifies the HTML cursor style.
DirectionSpecifies the HTML direction style.
DisplaySpecifies the HTML display style.
FilterSpecifies the HTML filter style.
FontFamilySpecifies the HTML fontfamily style.
FontSizeSpecifies the HTML fontsize style.
FontStyleSpecifies the HTML fontstyle style.
FontVariantSpecifies the HTML fontvariant style.
FontWeightSpecifies the HTML fontheight style.
HeightSpecifies the HTML height style.
LeftSpecifies the HTML left style.
ListStyleImageSpecifies the HTML liststyleimage style.
ListStyleTypeSpecifies the HTML liststyletype style.
MarginSpecifies the HTML margin style.
MarginBottomSpecifies the HTML marginbottom style.
MarginLeftSpecifies the HTML marginleft style.
MarginRightSpecifies the HTML marginright style.
MarginTopSpecifies the HTML margintop style.
OverflowSpecifies the HTML overflow style.
OverflowXSpecifies the HTML overflowx style.
OverflowYSpecifies the HTML overflowy style.
PaddingSpecifies the HTML padding style.
PaddingBottomSpecifies the HTML paddingbottom style.
PaddingLeftSpecifies the HTML paddingleft style.
PaddingRightSpecifies the HTML paddingright style.
PaddingTopSpecifies the HTML paddingtop style.
PositionSpecifies the HTML position style.
TextAlignSpecifies the HTML textalign style.
TextDecorationSpecifies the HTML textdecoration style.
TextOverflowSpecifies the HTML textoverflow style.
TopSpecifies the HTML top style.
VerticalAlignSpecifies the HTML verticalalign style.
VisibilitySpecifies the HTML visibility style.
WhiteSpaceSpecifies the HTML whitespace style.
WidthSpecifies the HTML width style.
ZIndexSpecifies the HTML zindex style.

HtmlTextWriter and Html32TextWriter objects use these enumeration values to register HTML strings to the proper HTML style.

The following example uses the HtmlTextWriterStyle enumeration with the AddStyleAttribute method to add a color style attribute to an HTML element and sets its value.

writer.AddStyleAttribute(HtmlTextWriterStyle.Color, "Red");

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
© 2015 Microsoft