Partager via


IHTMLStyle interface

This interface provides access to the methods that are returned when you access the style object.

Members

The IHTMLStyle interface inherits from the IDispatch interface. IHTMLStyle also has these types of members:

  • Methods
  • Properties

Methods

The IHTMLStyle interface has these methods.

Method Description
getAttribute

Retrieves the value of the specified attribute.

removeAttribute

Removes an attribute from an object.

setAttribute

Sets the value of the specified attribute.

 

Properties

The IHTMLStyle interface has these properties.

Property Access type Description

background

Specifies up to five separate background properties of an object.

backgroundAttachment

Specifies how the background image (or images) is attached to the object within the document.

backgroundColor

Specifies the color behind the content of the object.

backgroundImage

Specifies the background image or images of the object.

backgroundPosition

Specifies the position of the background of the object.

backgroundPositionX

Specifies the x-coordinate of the IHTMLStyle::backgroundPosition property.

backgroundPositionY

Specifies the y-coordinate of the IHTMLStyle::backgroundPosition property.

backgroundRepeat

Specifies whether and how the background image (or images) is tiled.

border

Specifies the properties of a border drawn around an object.

borderBottom

Specifies the properties of the bottom border of the object.

borderBottomColor

Specifies the foreground color of the bottom border of an object.

borderBottomStyle

Specifies the style of the bottom border of the object.

borderBottomWidth

Specifies the thickness of the bottom border of the object.

borderColor

Specifies the border color of the object.

borderLeft

Specifies the properties of the left border of the object.

borderLeftColor

Specifies the foreground color of the left border of an object.

borderLeftStyle

Sets or retrieves the style of the left border of the object.

borderLeftWidth

Specifies the thickness of the left border of the object.

borderRight

Specifies the properties of the right border of the object.

borderRightColor

Specifies the foreground color of the right border of an object.

borderRightStyle

Specifies the style of the right border of the object.

borderRightWidth

Specifies the thickness of the right border of the object.

borderStyle

Specifies the style of the left, right, top, and bottom borders of the object.

borderTop

Specifies the properties of the top border of the object.

borderTopColor

Specifies the foreground color of the top border of an object.

borderTopStyle

Specifies the style of the top border of the object.

borderTopWidth

Specifies the thickness of the top border of the object.

borderWidth

Specifies the thicknesses of the left, right, top, and bottom borders of an object.

clear

Specifies whether the object allows floating objects on its left side, right side, or both, so that the next text displays past the floating objects.

clip

Read/write

Specifies which part of a positioned object is visible.

color

The foreground color of the text of an object.

cssText

Read/write

Sets or retrieves the persisted representation of the style rule.

cursor

Specifies the type of cursor to display as the mouse pointer moves over the object.

display

Gets or sets a value that indicates whether and how the object is rendered.

filter

Sets or retrieves the filter or collection of filters that are applied to the object.

font

Specifies a combination of separate IHTMLStyle::font properties of the object. Alternatively, sets or retrieves one or more of six user-preference fonts.

fontFamily

Specifies the name of the font used for text in the object.

fontSize

Specifies a value that indicates the font size used for text in the object.

fontStyle

Specifies the font style of the object as italic, normal, or oblique.

fontVariant

Specifies whether the text of the object is in small capital letters.

fontWeight

Specifies the weight of the font of the object.

height

Sets or retrieves the height of the object.

left

Sets or retrieves the position of the object relative to the left edge of the next positioned object in the document hierarchy.

letterSpacing

Specifies the amount of additional space between letters in the object.

lineHeight

Sets or retrieves the distance between lines in the object.

listStyle

Sets or retrieves up to three separate IHTMLStyle::listStyle properties of the object.

listStyleImage

Sets or retrieves a value that indicates which image to use as a list-item marker for the object.

listStylePosition

Sets or retrieves a variable that indicates how the list-item marker is drawn relative to the content of the object.

listStyleType

Sets or retrieves the predefined type of the line-item marker for the object.

margin

Sets or retrieves the width of the top, right, bottom, and left margins of the object.

marginBottom

Sets or retrieves the height of the bottom margin of the object.

marginLeft

Sets or retrieves the width of the left margin of the object.

marginRight

Sets or retrieves the width of the right margin of the object.

marginTop

Sets or retrieves the height of the top margin of the object.

overflow

Sets or retrieves a value indicating how to manage the content of the object when the content exceeds the height or width of the object.

padding

Sets or retrieves the amount of space to insert between the object and its margin or, if there is a border, between the object and its border.

paddingBottom

Sets or retrieves the amount of space to insert between the bottom border of the object and the content.

paddingLeft

Sets or retrieves the amount of space to insert between the left border of the object and the content.

paddingRight

Sets or retrieves the amount of space to insert between the right border of the object and the content.

paddingTop

Sets or retrieves the amount of space to insert between the top border of the object and the content.

pageBreakAfter

Sets or retrieves a value indicating whether a page break occurs after the object.

pageBreakBefore

Defines whether a page break occurs before the object.

pixelHeight

Sets or retrieves the height of the object.

pixelLeft

Sets or retrieves the left position of the object.

pixelTop

Sets or retrieves the top position of the object.

pixelWidth

Sets or retrieves the width of the object.

posHeight

Sets or retrieves the height of the object in the units specified by the IHTMLStyle::height attribute.

position

Sets or retrieves the type of positioning used for the object.

posLeft

Sets or retrieves the left position of the object in the units specified by the IHTMLStyle::left attribute.

posTop

Sets or retrieves the top position of the object in the units specified by the IHTMLStyle::top attribute.

posWidth

Sets or retrieves the width of the object in the units specified by the IHTMLStyle::width attribute.

styleFloat

Sets or retrieves on which side of the object the text will flow.

textAlign

Specifies whether the text in the object is left-aligned, right-aligned, centered, or justified.

textDecoration

Specifies a value that indicates whether the text in the object has blink, line-through, overline, or underline decorations.

textDecorationBlink

Sets or retrieves a Boolean value that indicates whether the object's IHTMLStyle::textDecoration property has a value of "blink."

This property is not supported for Windows apps using JavaScript.

textDecorationLineThrough

Sets or retrieves a Boolean value indicating whether the text in the object has a line drawn through it.

textDecorationNone

Sets or retrieves the Boolean value indicating whether the IHTMLStyle::textDecoration property for the object has been set to none.

textDecorationOverline

Sets or retrieves a Boolean value indicating whether the text in the object has a line drawn over it.

textDecorationUnderline

Sets or retrieves whether the text in the object is underlined.

textIndent

Specifies the indentation of the first line of text in the object.

This property is not supported for Windows apps using JavaScript.

textTransform

Specifies the rendering of the text in the object.

top

Sets or retrieves the position of the object relative to the top of the next positioned object in the document hierarchy.

verticalAlign

Sets or retrieves the vertical alignment of the object.

visibility

Sets or retrieves whether the content of the object is displayed.

whiteSpace

Specifies a value that indicates whether lines are automatically broken inside the object.

width

Specifies the width of the object.

wordSpacing

Specifies the amount of additional space between words in the object.

zIndex

Sets or retrieves the stacking order of positioned objects.

 

Remarks

A style object represents the current settings of all possible inline styles for a given element. Inline styles are Cascading Style Sheets (CSS) assignments that an author applies directly to individual HTML elements using the IHTMLStyle attribute. You use the style object to examine these assignments and either make new assignments or change existing ones.

You retrieve the style object by using the IHTMLElement::style function. You retrieve the current setting for an inline style by calling member functions of the style object.

The style object does not give access to the style assignments in style sheets. You can use the IHTMLStyleSheetsCollection interface to gain access to the individual style sheets defined in the document.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

IDispatch

Reference

IHTMLStyle2

IHTMLStyle3

IHTMLStyle4

IHTMLStyle5