I'm having trouble setting something to float right in JS. My code is as follows:
var closebutton = document.createElement('div');
closebutton.style.styleFloat = "right";
alert(closebutton.style.styleFloat);
closebutton.style.background = "#f00";
closebutton.innerHTML = '<a href="">✖</a>';
titlebar.appendChild(closebutton);
The background of the element is indeed red, and when loaded the page alerts "right". Yet the div is not floated right. Firebug shows no trace of the float. There are no errors or warnings in the Error Console.
I'm stumped!
Update:
As suggested, I have also tried:
closebutton.style.float = 'right';
This also does not work, and is highlighted bright red in my text-editor (gedit)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…