Name

STYLE — NN 4 IE 3 HTML 4

Synopsis

STYLE=”styleSheetProperties"

Optional

This attribute lets you set one or more style sheet rule property assignments for the current element. You may use the CSS or JavaScript syntax for assigning style attributes. But if you are designing the page for cross-browser deployment, use only the CSS syntax, which both Navigator and Internet Explorer support.

For use in Version 4 browsers, style sheets are recommended over dedicated attributes where applicable, but due to the implementation in Navigator 4, you need to wrap IMG elements with DIV or SPAN elements that contain border and margin-related style sheet rules to make them work with IMG elements. The following example with the embedded STYLE attribute works only in Internet Explorer.

Example

<IMG STYLE="padding-left:5px" SRC="surferDude.gif" HEIGHT=150 WIDTH=250>

Value

An entire CSS-syntax style sheet rule is enclosed in quotes. Multiple style attribute settings are separated by semicolons. Style sheet attributes are detailed in Chapter 10.

Default

None.

Object Model Reference

IE

[window.]document.images[i].style

[window.]document.imageName.style

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.