Reputation: 18097
when i use element.style.left = 1.6px;
this only sets property to 1. Not 1.6px. Which is not right. Is there a way to do this correctly.
Only i can think of is add new stylesheet to the whole body and delete the old one...seems like too much though.
Upvotes: 1
Views: 342
Reputation: 18995
Try using
element.style.left = "1.6px";
Because css properties are strings in Javascript.
Upvotes: 2
Reputation: 229
This is because we can't operate on anything other than multiples of 1 pixel in CSS. Think of the page as a grid of pixels - we can't write between the lines of the grid! Why is it that you need 1.6px specifically?
Upvotes: 0