Name
style — NN n/a IE 4 DOM 1
Synopsis
Almost every object that reflects an
HTML element has a style object associated with it
(as you can see from the style property that
pervades the object listings in this chapter). The
style object reflects the STYLE
attribute set in the element’s tag. If the element is under the
influence of a style sheet rule that is set in a
STYLE element (assigned to a selector that applies
to the current element), those style sheet values are not part of the
style object. Even if the element is under the
influence of one of these distant style sheet rules, you can still
assign a value to any style object property for
any element: the setting is likely to override (by virtue of the
cascading rules described in Chapter 3) styles
assigned from a STYLE element.
From a scripting point of view, it is important to know that while a
style object’s property exhibits a default
behavior (a font size or alignment, for example), the default value
may not be reflected in the property unless the value has been
explicitly set in the element tag’s STYLE
attribute or assigned by another script statement. The Macintosh
version of Internet Explorer 4 is a bit better in exposing default
values, but by and large, a style object’s
property default value is an empty string or null.
Therefore, do not expect condition testing to necessarily reveal the
current value of a property unless it has been set previously.
The properties of the style object correspond to the CSS attributes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access