View Full Version : Div position
shernoam
09-01-2001, 10:32 AM
Hi !
How can I do that the picture (Div) will be 33pixels from the top BUT centered horizontally ...(left)
<DIV id=coverL
style="Z-INDEX: 1; LEFT: 0px; VISIBILITY: visible; POSITION: absolute; TOP: 33px"><A href="some url">
<img src="img/l.GIF"></A></DIV>
thanks
shernoam
09-01-2001, 11:13 AM
May be I had to explain more about the problem...
In my css file I have:
#linka {
Z-INDEX: 1; VISIBILITY: hidden; POSITION: absolute; TOP: 33px
}
.boxmen {
COLOR: #000000; BACKGROUND-COLOR: #EFB30F;border-color: #000000; border-width:2px; border-style:solid;
}
in my html I have:
<DIV id=linka>
<TABLE class=boxmen cellSpacing=0 cellPadding=5 width=202px
height=57>
<TBODY>
<TR align=left>
<TD width="80" height="47"><FONT face=Arial size=1><A
href="http://sademo.za.net/newsarc.php3">News Archive</A></FONT><BR><FONT face=Arial size=1><A
href="http://www.cfxweb.net/">Cfxweb.net</A></FONT><BR><FONT face=Arial
size=1><A href="http://www.flipcode.com/">FlipCode.com</A></FONT></TD>
<TD width="80" height="47"><FONT face=Arial
size=1><A href="http://www.slashdot.org/">Slashdot</A></FONT><BR><FONT
face=Arial size=1><A href="http://www.theregister.co.uk/">The
Register</A></FONT><BR><FONT face=Arial size=1><A
href="http://sitereview.org/">Site
Review</A></FONT></TD></TR>
</TBODY></TABLE>
</DIV>
Don't worry about : VISIBILITY: hidden;
(it's part of a script...)
How can I locate the <DIV id=linka> in the center (horizontally & 33 pixels from the top)
COBOLdinosaur
09-01-2001, 03:17 PM
The setup us fine, but you need to reposition it based on the resolution after you have loaded it.
The top is already set to 33 so for the horizontal position try:
<body onLoad="setpos()">
and put the function in the head:
<script language="JavaScript">
<!--
function setpos()
{
var theleft=(window.screen.width/2) - 101;
if (document.all) document.all["linka"].style.left=theleft;
if (document.layers)document.layers["linka"].left=theleft;
//-->
</script>
that wil take care of IE and Netscrap 4.x
for Netscrap 6 it will be somthing like document.getElementBtId("linka")style.left
shernoam
09-02-2001, 04:04 AM
I done that...
It didn't worked...
(plus I saw an error on the status bar...)
COBOLdinosaur
09-02-2001, 10:47 AM
What is the error message? what browser are you looking at it with? If you have the page up somewhere post the link.
shernoam
09-02-2001, 04:09 PM
ok...
I will send you this...
send me your email
my email:
shernoam@hotmail.com
COBOLdinosaur
09-02-2001, 07:26 PM
On IE 5.5 is positions coorrectly in the center at every resolution I tried, and for every screen re-sizing.
I do not see any errors.
Therefore the problem you are seeing is platform specific.
I running windows 2000 pro on an overclocked p3.
Check it on some other machines an see if they alos have the same problem you are seeing, because it works perfectly for me.
shernoam
09-04-2001, 08:50 AM
It's not exactly at the middle...
can't you see?
(it's close...but not EXACTLY...)
petervazed
09-04-2001, 02:23 PM
Change this part:
var theleft=(window.screen.width/2) - 118
101 --- > 118 is then in the middle on my comp. screen
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.