I have 2 divs in different locations #UserNav and #Search. I want to make them side by side using position: absolute, And I could easily use right, left properties to align, But, The problem is sometimes the first div changes the width which causes to cross the other div
Now i would like to output the width of the first div and apply it on the second div so they are always side by side
For example on the below code using jQuery
$(document).ready(); {
var userNav = $('#UserNav').outerWidth();
$("#Search").css('right', userNav);
};
This works fine, I'm getting the width of UserNav and applying the value on Search div
But, The problem is, now this code functions after the page loads and causes the second div to use the value after SOME milliseconds and its an ugly style :) Is there any other options so the code works faster or before anything else?