Blog Post

CamelCasing Zombie CSS (in JavaScript)

About the only major CSS property that doesn’t follow the exact property name (e.g. color) or camelCase for hyphenated properties (e.g. backgroundColor) is float, because float is a reserved word in JavaScript. The CSS float property in JavaScript is cssFloat:

#zombie {
   float: left;
}Code language: CSS (css)
zombie.style.cssFloat = "left";Code language: JavaScript (javascript)

In JavaScript, float stands for floating-point numbers, more commonly known as decimals, or any number that includes a decimal point. In computer science, integers (whole numbers with no decimal point) and floating-point numbers/decimals are treated a bit differently because of how they have to be stored by the computer.