Share via


cssText Property

Returns or sets a String that represents the value of an inline style sheet for a specified element.

expression.cssText

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Remarks

The value of the cssText property is the cascading style sheet property name followed by a colon and the value of the property. For example, "background-color:yellow" sets the background color of an element to yellow.

For a list of possible properties and values see the CSS Reference on the Microsoft Developer Network (MSDN) Web site.

Example

The following example adds an inline style that changes the background color of the first paragraph in the active document to yellow.

 Dim objPara As FPHTMLParaElement

 Set objPara = ActiveDocument.all.tags("p").Item(0)
 objPara.Style.cssText = "background-color:yellow"

Applies to | FPHTMLStyle Object | FPHTMLStyleSheet Object | IHTMLRuleStyle Object | IHTMLStyle Object | IHTMLStyleSheet Object