HTML and CSS Reference
In-Depth Information
e Mystery Of e CSS Float Property - Part II
Changing the Float Property with JavaScript
To change a CSS value in JavaScript, you would access the style object,
converting the intended CSS property to “camel case”. For example, the
CSS property “margin-left” becomes marginLeft ; the property
background-color becomes backgroundColor , and so on. But with
the float property, it's di " erent, because float is already a reserved
word in JavaScript. So, the following would be incorrect:
myDiv.style.float = "left";
Instead, you would use one of the following:
// For Internet Explorer
myDiv.style.styleFloat = "left";
// For all other browsers
myDiv.style.cssFloat = "left";
Search WWH ::




Custom Search