ashers
03-17-2004, 11:21 AM
Whats the best way to position an iframe, so it displays totally central on a page on whatever resolution?
Thanks
Ash
Thanks
Ash
|
Click to See Complete Forum and Search --> : Positioning ashers 03-17-2004, 11:21 AM Whats the best way to position an iframe, so it displays totally central on a page on whatever resolution? Thanks Ash PeOfEo 03-17-2004, 11:24 AM http://bluerobot.com/web/css/center1.html jeff_archer7 03-20-2004, 04:25 AM microsoft is better baby PeOfEo 03-20-2004, 06:42 PM Originally posted by jeff_archer7 microsoft is better baby :confused: neil9999 03-21-2004, 03:39 AM Here's a way using javascript you could have as a backup: <script type="text/javascript"> function centre(){ var fw=document.body.clientWidth; var fh=document.body.clientHeight; //enter width of div var dw=400; //enter height of div var dh=200; var cw=fw-dw; var ch=fh-dh; document.getElementById("divy").style.left=cw/2; document.getElementById("divy").style.top=ch/2; } </script> </head> <body onload="centre()"> <div style="width:400px; height:200px; position:absolute; left:100; top:150; border-style: solid; border-width: 3" id="divy"> HELLO HELLO HELLO HELLO HELLO HELLO HELLO HELLO HELLO </div> You could probably edit it for an I-frame. Neil EDIT: Put this in your <body> tag: onresize="centre()" PeOfEo 03-21-2004, 11:19 PM why would you want to use that. It still uses css so why get js involved. If the user does not support css neither will work and the document will go into an unstyled form. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |