Friday, February 15, 2008

Javascript Naming for CSS Float Property

Typically, you can access a CSS property of an element in Javascript using something similar to:


elem.style.propertyName = "value";


Where the propertyName is the property name in CSS with no dashes and written in camel format. For example text-align becomes textAlign. However, for the CSS float property this is a problem because float a keyword in Javascript. Therefore instead you have to use cssFloat.

No comments: