![]() |
center div over another div
I want to center the div "KungFu" over the div "header". Does not. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//DE"> <html> <body> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> <br> <nobr> <br> &nbs p; <div id="header">HERE IST THE HEADER</div></p> </nobr> <div id="KungFu"></div> <script type="text/javascript"> // // // function displayFloatingDiv(divId, title, message, center_over_Id, width, height) { var left, top; var parent = document.getElementById(center_over_Id); left = Math.max(0, parent.offsetLeft+ (parent.offsetWidth-width)); top = Math.max(0, parent.offsetTop+ (parent.offsetHeight-height)); var Div = document.getElementById(divId); Div.style.position = 'absolute'; Div.style.width = width + 'px'; Div.style.height = height + 'px'; Div.style.left = left + 'px'; Div.style.top = top + 'px'; alert(parent+' - l:'+left+' t:'+top+' w:'+(parent.offsetWidth-width)); var addHeader; addHeader = '<table style="width:' + width + 'px" bgcolor="red">' + '<tr><td onclick="document.getElementById(\''+divId+'\').st yle.visibility=\'hidden\'">' + title + '</td>' + '<td style="width:18px" align="right">' + 'Close...</td></tr><tr><td colspan="2">'+message+'</td></tr></table>'; // add to your div an header Div.innerHTML = addHeader; Div.className = 'dimming'; Div.style.visibility = "visible"; } displayFloatingDiv("KungFu", "Title", "Some long message", "header", 320, 240); </script> </body></html> |
Re: center div over another div
Gernot Frisch said the following on 3/16/2006 8:10 AM:
> I want to center the div "KungFu" over the div "header". > Does not. news:comp.infosystems.www.authoring.stylesheets is a better place to ask CSS questions. -- Randy comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/ |
| All times are GMT. The time now is 04:53 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.