Visit Mozilla.org

Talk:CSS:float

From MDC

[edit] Why is 'float' spelled 'cssFloat'?

When referring to the css property 'float', from javascript you have to use the variable name 'cssFloat'. Whereas other css properties are referred to by their normal name (or the margin-left -> marginLeft sort of thing). Why is cssFloat different?

JavaScript steals much of its syntax and some of builtin functionality from Java. One of the things stolen from Java was its set of key and reserved words. float in Java specifies a floating-point value type, and it was left reserved in JavaScript as a result, so you couldn't use it as a property name without using e.style["float"]. I refer to JS here because it's most relevant to web developers, but the relevant DOM specs aren't JS-specific and could be implemented for other languages, too, so "float" was ruled out for their sakes as well. --Waldo 23:48, 2 January 2008 (PST)