Let’s say I already have code to create DIV’s with the CSS “float:left” property. I want to add these floating DIV’s to the beginning of the container DIV instead of to the end because there’s a “clear:both” line break that will make the container expand as I insert new floating DIV’s.
<div id="container">
<br class="clear" />
</div>
Is there such a function like this fake “prependChild” I made up?
var container = document.getElementById("container");
cointainer.prependChild(floatDiv1);
cointainer.prependChild(floatDiv2);
cointainer.prependChild(floatDiv3);
Which will change the HTML to:
<div id="container">
<div class="floatLeft"></div>
<div class="floatLeft"></div>
<div class="floatLeft"></div>
<br class="clear" />
</div>