CSS and stylesheets API
|
Object |
Description |
Availability |
|---|---|---|
|
Represents any counter or counters function value. |
4.6 or later |
|
|
Represents an @charset rule, which holds an encoding definition. |
4.6 or later |
|
|
Represents an @font-face rule, which holds a set of font descriptions. |
4.6 or later |
|
|
Represents an @import rule, which imports style rules from other style sheets. |
4.6 or later |
|
|
Represents an @media rule, which defines style rules for a specific media type. |
4.6 or later |
|
|
Represents a @page rule, which specifies the dimensions, orientation, and margins for paged media. |
4.6 or later |
|
|
Represents a single CSS value. |
4.6 or later |
|
|
The base class that defines any rule in a CSS style sheet, including rule sets and @ rules. |
4.6 or later |
|
|
Represents an ordered collection of CSSRule objects. |
4.6 or later |
|
|
Represents a CSS declaration block that consists of CSS properties and their values. |
4.6 or later |
|
|
Represents a single rule set in a CSS style sheet. |
4.6 or later |
|
|
Represents a CSS style sheet. |
4.6 or later |
|
|
Represents an unsupported @ rule. |
4.6 or later |
|
|
Represents a simple or complex CSS property value. |
4.6 or later |
|
|
Represents an ordered collection of CSSValue objects. |
4.6 or later |
|
|
Represents an ordered collection of media. An empty list is equivalent to a list that contains a value of all. |
4.6 or later |
|
|
Represents a Rect value. |
4.6 or later |
|
|
Represents an RGB color value. |
4.6 or later |
|
|
Represents a single external or inline style sheet that is associated with a document. |
4.6 or later |
|
|
Represents an ordered collection of StyleSheet objects. |
4.6 or later |
Object: Counter
Counter properties
|
Property name |
Type |
Description |
Status |
Support level |
Availability |
|---|---|---|---|---|---|
|
DOMString |
Returns the identifier of the counter. |
read only |
DOM 2 Style |
4.6 or later |
|
|
DOMString |
Returns the style of the list. |
read only |
DOM 2 Style |
4.6 or later |
|
|
DOMString |
Returns the string used to separate nested counters. |
read only |
DOM 2 Style |
4.6 or later |
Object: CSSCharsetRule
The CSSCharsetRule object represents an @charset rule in a CSS style sheet. The @charset rule holds an encoding definition.
The value of the encoding property does not affect the encoding of text data in the DOM objects; this encoding is always UTF-16. After a style sheet is loaded, the value of the encoding property is the value found in the @charset rule. If there was no @charset in the original document, then no CSSCharsetRule object is created. The value of the encoding property may also be used as a hint for the encoding used on serialization of the style sheet.
The value of the @charset rule (and therefore of the CSSCharsetRule object) may not correspond to the encoding the document actually came in; character encoding information, for example, in an HTTP header, has priority but this is not reflected in the CSSCharsetRule.
CSSCharsetRule properties
CSSFontFaceRule properties
Object: CSSImportRule
CSSImportRule properties
|
Property name |
Type |
Description |
Status |
Support level |
Availability |
|---|---|---|---|---|---|
|
href |
DOMString |
Returns the location of the style sheet to be imported. The attribute does not contain the "url(...)" specifier around the URI. |
read only |
4.6 or later |
|
|
media |
Returns a list of media types that this style sheet can be used with. |
read only |
4.6 or later |
||
|
styleSheet |
Returns the CSSStyleSheet object referred to by this rule, if it has been loaded. |
read only |
4.6 or later |
CSSMediaRule properties
CSSMediaRule methods
CSSPageRule properties
Object: CSSPrimitiveValue
The CSSPrimitiveValue object represents a single CSS value. A CSSPrimitiveValue object only occurs in the context of a CSS property.
This object has methods to determine the current value of a specific style property, or to explicitly set a style property. Conversions are allowed between absolute values (from millimeters to centimeters, from degrees to radians, and so on) but not between relative values. For example, a pixel value cannot be converted to a centimeter value. With the exception of values representing colors, percentage values can not be converted, since they are relative to another value.
Because a color percentage value is relative to a known range (0 to 255), however, a color percentage value can be converted to a number.
CSSPrimitiveValue constants
|
Constant |
Value type |
Description |
Support level |
Availability |
|---|---|---|---|---|
|
0 |
CSS_UNKNOWN |
An unrecognized unit type. |
DOM 2 Style |
4.6 or later |
|
1 |
CSS_NUMBER |
A simple number value. |
DOM 2 Style |
4.6 or later |
|
2 |
CSS_PERCENTAGE |
A percentage value. |
DOM 2 Style |
4.6 or later |
|
3 |
CSS_EMS |
A length value, based on font size. |
DOM 2 Style |
4.6 or later |
|
4 |
CSS_EXS |
A length value, based on font x-height. |
DOM 2 Style |
4.6 or later |
|
5 |
CSS_PX |
A length value, in pixels. |
DOM 2 Style |
4.6 or later |
|
6 |
CSS_CM |
A length value, in centimeters. |
DOM 2 Style |
4.6 or later |
|
7 |
CSS_MM |
A length value, in millimeters. |
DOM 2 Style |
4.6 or later |
|
8 |
CSS_IN |
A length value, in inches. |
DOM 2 Style |
4.6 or later |
|
9 |
CSS_PT |
A length value, in points. |
DOM 2 Style |
4.6 or later |
|
10 |
CSS_PC |
A length value, in picas. |
DOM 2 Style |
4.6 or later |
|
11 |
CSS_DEG |
An angle value, in degrees. |
DOM 2 Style |
4.6 or later |
|
12 |
CSS_RAD |
An angle value, in radians. |
DOM 2 Style |
4.6 or later |
|
13 |
CSS_GRAD |
An angle value, in grads. |
DOM 2 Style |
4.6 or later |
|
14 |
CSS_MS |
A time value, in milliseconds. |
DOM 2 Style |
4.6 or later |
|
15 |
CSS_S |
A time value, in seconds. |
DOM 2 Style |
4.6 or later |
|
16 |
CSS_HZ |
A frequency value, in Hertz. |
DOM 2 Style |
4.6 or later |
|
17 |
CSS_KHZ |
A frequency, in kiloHertz. |
DOM 2 Style |
4.6 or later |
|
18 |
CSS_DIMENSION |
A number value of an unknown dimension. |
DOM 2 Style |
4.6 or later |
|
19 |
CSS_STRING |
A simple string value. |
DOM 2 Style |
4.6 or later |
|
20 |
CSS_URI |
A string value representing a URI. |
DOM 2 Style |
4.6 or later |
|
21 |
CSS_IDENT |
A string value representing an identifier. |
DOM 2 Style |
4.6 or later |
|
22 |
CSS_ATTR |
A string value representing an attribute function. |
DOM 2 Style |
4.6 or later |
|
23 |
CSS_COUNTER |
A counter or counters function. |
DOM 2 Style |
4.6 or later |
|
24 |
CSS_RECT |
A Rect function. |
DOM 2 Style |
4.6 or later |
|
25 |
CSS_RGBCOLOR |
An RGBColor function. |
DOM 2 Style |
4.6 or later |
CSSPrimitiveValue properties
CSSPrimitiveValue methods
|
Method name |
Description |
Support level |
Availability |
|---|---|---|---|
|
getCounterValue() |
Retrieves a Counter value. |
4.6 or later |
|
|
getFloatValue() |
Retrieves a float value. |
4.6 or later |
|
|
getRectValue() |
Retrieves a Rect value. |
4.6 or later |
|
|
getRGBColorValue() |
Retrieves an RGBColor value. |
4.6 or later |
|
|
getStringValue() |
Retrieves a string value. |
4.6 or later |
|
|
setFloatValue() |
Sets a float value with the specified unit. |
4.6 or later |
|
|
setStringValue() |
Sets a string value with the specified unit. |
4.6 or later |
Object: CSSRuleList
The CSSRuleList object represents an ordered collection of CSSRule objects.
CSSRuleList properties
CSSRuleList methods
Object: CSSRule
Availability |
|
Extended by |
CSSCharsetRule, CSSFontFaceRule, CSSImportRule, CSSMediaRule, CSSPageRule, CSSStyleRule, CSSUnknownRule |
CSSRule constants
|
Constant |
Value type |
Description |
Support level |
Availability |
|---|---|---|---|---|
|
0 |
UNKNOWN_RULE |
DOM 2 Style |
4.6 or later |
|
|
1 |
STYLE_RULE |
A CSSStyleRule. |
DOM 2 Style |
4.6 or later |
|
2 |
CHARSET_RULE |
DOM 2 Style |
4.6 or later |
|
|
3 |
IMPORT_RULE |
DOM 2 Style |
4.6 or later |
|
|
4 |
MEDIA_RULE |
A CSSMediaRule. |
DOM 2 Style |
4.6 or later |
|
5 |
FONT_FACE_RULE |
DOM 2 Style |
4.6 or later |
|
|
6 |
PAGE_RULE |
A CSSPageRule. |
DOM 2 Style |
4.6 or later |
CSSRule properties
|
Property name |
Type |
Description |
Status |
Support level |
Availability |
|---|---|---|---|---|---|
|
parentRule |
Returns the parent rule, if this rule is contained within another rule (for example, a style rule within an @media block). |
read only |
4.6 or later |
||
|
parentStyleSheet |
Returns the style sheet that contains this rule. |
read only |
4.6 or later |
||
|
type |
unsigned short |
Returns the type of rule, represented using a CSSRule constant. |
read only |
4.6 or later |
Object: CSSStyleDeclaration
The CSSStyleDeclaration object represents a CSS declaration block consisting of CSS properties and their values. This object enables you to determine the style properties currently set in a block or to set style properties explicitly within the block.
This object also provides access to the computed values of an element. It does not provide access to the specified or actual values of the CSS cascade.
CSSStyleDeclaration properties
|
Property name |
Type |
Description |
Status |
Support level |
Availability |
|---|---|---|---|---|---|
|
cssText |
DOMString |
Specifies the name of the CSS selector for the rule set. |
writable |
4.6 or later |
|
|
length |
int |
Returns the number of properties that have been explicitly set. |
read only |
4.6 or later |
|
|
parentRule |
Returns the CSSRule that contains this declaration block. |
read only |
4.6 or later |
CSSStyleDeclaration methods
|
Method name |
Description |
Support level |
Availability |
|---|---|---|---|
|
getPropertyCSSValue() |
Returns the value of a CSS property as an object, if the property has been explicitly set. |
4.6 or later |
|
|
getPropertyPriority() |
Returns the priority of a CSS property. |
4.6 or later |
|
|
getPropertyValue() |
Returns the value of a CSS property as a string, if the property has been explicitly set. |
4.6 or later |
|
|
item() |
Returns the name of the CSS property at the specified index in the collection. |
4.6 or later |
|
|
removeProperty() |
Removes a CSS property from the style declaration block. |
4.6 or later |
|
|
setProperty() |
Sets the value of a CSS property for the style declaration block. |
4.6 or later |
CSSStyleRule properties
CSSStyleSheet methods
CSSStyleSheet properties
|
Property name |
Type |
Description |
Status |
Support level |
Availability |
|---|---|---|---|---|---|
|
CSSRules |
Returns a list of all CSS rules contained within the style sheet. This includes both rule sets and at-rules. |
read only |
4.6 or later |
||
|
ownerRule |
Returns the CSSImportRule object for imported style sheets. If the style sheet is not imported, the value for this property is null. |
read only |
4.6 or later |
CSSValue constants
|
Constant |
Value type |
Description |
Support level |
Availability |
|---|---|---|---|---|
|
0 |
CSS_INHERIT |
An inherited value. |
DOM 2 Style |
4.6 or later |
|
1 |
CSS_PRIMITIVE |
DOM 2 Style |
4.6 or later |
|
|
2 |
CSS_VALUE_LIST |
A CSSValueList. |
DOM 2 Style |
4.6 or later |
|
3 |
CSS_CUSTOM |
A custom value. |
DOM 2 Style |
4.6 or later |
CSSValue properties
|
Property name |
Type |
Description |
Status |
Support level |
Availability |
|---|---|---|---|---|---|
|
CSSValueType |
unsigned short |
Returns the type of value, represented using a CSSValue constant. |
read only |
4.6 or later |
CSSValueList methods
|
Method name |
Description |
Support level |
Availability |
|---|---|---|---|
|
item() |
Returns the CSSValue object by ordinal index . |
4.6 or later |
CSSValueList properties
Object: MediaList
MediaList properties
MediaList methods
Object: Rect
Rect properties
|
Property name |
Type |
Description |
Status |
Support level |
Availability |
|---|---|---|---|---|---|
|
bottom |
String |
Returns the style for the bottom of the Rect. |
read only |
4.6 or later |
|
|
left |
String |
Returns the style for the left side of the Rect. |
read only |
4.6 or later |
|
|
right |
String |
Returns the style for the right side of the Rect. |
read only |
4.6 or later |
|
|
top |
String |
Returns the style for the top of the Rect. |
read only |
4.6 or later |
Object: RGBColor
The RGBColor object represents an RGB color value.
The RGBColor object contains three properties, each of which specifies the value for a different color channel for the overall color. Valid color channel values can be either a numerical value between 0 and 255, or a percentage between 0% and 100%, although values outside of those ranges are not clipped.
RGBColor properties
Object: StyleSheet
StyleSheet properties
|
Property name |
Type |
Description |
Status |
Support level |
Availability |
|---|---|---|---|---|---|
|
disabled |
boolean |
When true, indicates that the style sheet is not applied. Note that if the media specified in the MediaList object returned by StyleSheet.media is not supported by the BlackBerry Browser, then this property is ignored. |
writable |
4.6 or later |
|
|
href |
DOMString |
Returns the URI of an external style sheet. |
read only |
4.6 or later |
|
|
media |
Returns the destination media for the style information. If no media has been specified, this property returns the empty MediaList object. The media is often specified in StyleSheet.ownerNode. |
read only |
DOM 2 Style |
4.6 or later |
|
|
ownerNode |
Returns the Node that associates this style sheet with the document. For HTML documents, this is typically the corresponding <link> or <style> element. If the style sheet is the child of another style sheet, this property returns null. |
read only |
4.6 or later |
||
|
parentStyleSheet |
Returns the StyleSheet object that contains the style sheet, if one exists. If the style sheet is not the child of another style sheet, this property returns null. |
read only |
4.6 or later |
||
|
title |
DOMString |
Returns the title of the style sheet. The title is often specified in StyleSheet.ownerNode. |
read only |
4.6 or later |
|
|
type |
DOMString |
Returns the style sheet language used by the style sheet, specified as a content type, such as “text/css”. The content type is often specified in StyleSheet.ownerNode. |
read only |
4.6 or later |
Object: StyleSheetList
The StyleSheetList object represents an ordered collection of StyleSheet objects.
You can access an individual StyleSheet within a collection by its index position using StyleSheetList.item() or you can index the object directly. For example, if you create an instance of a StyleSheetList object called myStyleSheets, then specifying
StyleSheetList properties
StyleSheetList methods
|
Method name |
Description |
Support level |
Availability |
|---|---|---|---|
|
Returns the StyleSheet object at the specified index in the StyleSheetList. |
DOM 2 Style |
4.6 or later |