when is marginLeft being used:
$("div").css({ marginLeft:'12px', backgroundPosition:'10px -10px', minHeight: '40px' });
As you can see, attributes that has a hyphen on it are converted to camelcased format. Using the margin-left
from the previous code block above would make JavaScript bonkers because it will treat the hyphen as an operation for subtraction.
when is margin-left used:
$("div").css("margin-left","12px").css("background-position","10px -10px").css("min-height","40px");
Theoretically, both code blocks will do the same thing. We can allow hyphens on the second block because it is a string value while compared to the first block, it is somewhat an object.
Now that should make sense.