cbreemer
King Coder
One of the things that keep tripping me up and annoying me is that style attribute names seem to be inconsistent between the DOM and CSS.
For example to specify a red background in the CSS I need
but if I want to do that dynamically in JS I need to do
That difference in spelling (
For example to specify a red background in the CSS I need
CSS:
background-color : red;
JavaScript:
element.backgroundColor = 'red';
That difference in spelling (
background-color
vs. backgroundColor
) is driving me nuts. Would there be a good reason for this or is it just bad design aimed at confusing programmers ? Or is there something I'm not getting here ? Would love to hear some thoughts on this.