camelCase OK for jQuery

CamelCase refers to a method of combining words into compound words. Instead of using a hyphen to connect two words, camelCase removes the hyphen or space between the words and capitalizes the second word.

jQuery doesn’t mind if you use camelCase when specifying CSS properties, so ‘border-color’ means the same as ‘borderColor’.

The hyphenated property name should always be used in CSS stylesheets, for example, background-color.

  background-color: #fff;
  color: #000;

In jQuery either the hyphenated background-color or camelCase backgroundColor could be used.

$(document).ready(function() {
    height: '+=100px',
    backgroundColor: '#eee',
  }, 2000, 'linear');


  1. Single quote marks are needed if the hyphenated property is used, but the non-hyphenated camelCase doesn’t require single quotes around the property name.
  2. The values for each property should be inside single quotes.

Which case you’ll use comes down to personal preference. I like to type fewer quotes and hyphens, so I tend to use camelCase where ever possible.