AboutAnthony Levensalor Experience I have been programming in Java and Javascript since 1998. I run a web development company that specializes in Ajax front ends with PHP/MySQL back ends. I am a Sun Certified Java 2 Developer, and have done nothing but web applications for the last two years in my business
Past/Present clients Monster.com, Compuware Corporation, Flextronics International, Pragmatech Software, Open Travel Software, The Loss Mitigation Institute, Raw Story Media, Page One News Media.
Expert: Anthony Levensalor Date: 9/26/2007 Subject: Adjut div position depending on othe div
Question I have two divs, on captures info and the displays save etc.
Now the prob is the display of info div is not constant. It will be displayed at times and mot other.
The prob is to display the save div relatively to the info div.
i.e. if info div is displayed the save div should be displayed next to it, if info div is not displayed then the saveDiv should be displayed next to the text before the info div.
Please advise
- Anu
Answer You can try playing with the style attributes of the div in question, sounds like float:left; or some such might suit your needs. Since I'm no expert in HTML formatting, best I can do is give you some code I would try.
if info div is displayed:
infodiv.setAttribute("style", "float:left;");
if infodiv is !displayed:
savediv.setAttribute("style", "float:right");
By dynamically changing the styles, you can play around with the attributes until you can make it fit. For the actual formatting, try an HTML or CSS expert, those guys are the bomb.