This is almost correct.
Since - is a javascript operator, you cannot really have this in property names. If you set border or something one-word like this, your code will work fine.
However, what you need to remember for padding-top and for any name of a portable attribute is that in javascript you remove the hyphen and make the next letter in upper case, so in your case it will be paddingTop .
There are other exceptions. JavaScript has a few reserved words, so you cannot set a float , like this. Instead, in some browsers you need to use cssFloat , and in other styleFloat . It is for such discrepancies that it is recommended to use a framework such as jQuery, which handles browser incompatibilities for you ...
David Hedlund Mar 04 2018-11-11T00: 00Z
source share