View Full Version : Div Problem


Blurredream
09-20-2004, 08:45 PM
Please help me, I'm new to divs and I can't get it to work right.

<html>
<head>
<title>Site Title..</title>
</head>
<body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">

<table align="center" width="700" height="100%" border="0" cellpadding="0" cellspacing="0" background="index_02.jpg">
<tr>
<td width="700" height="580">
<img src="index_01.jpg" width="700" height="580" border="0">
</td>
</tr>
<tr>
<td valign="top" width="700">
<!-- CONTENT BEGINS HERE -->

<div id=layer1 style="position:absolute; top:207; left:407; width:300; height:300; z-index:1; padding:5px; border: #000000 0px solid;">

Content..............

</div>

<!-- CONTENT ENDS HERE -->
</td>
</tr>
</table>

</body>
</html>

The problem is that when I change the resolution of my screen my div moves. It doesn't stay where I want it to.. I tried removing the "absolute;" but now it is stuck in one area and not where I want it. Any suggestions?

Monkey Bizzle
09-20-2004, 10:16 PM
<div id="layer1" style="position: absolute; top: 207px; left: 407px; width: 300px; height: 300px; z-index: 1; padding: 5px; border: #000000 0px solid;">

Content..............

</div>

try adding in the parts in red... and take out the bold part cause the border isn't showing anyways cause you have it set to 0px wide

Blurredream
09-21-2004, 12:42 AM
That made it stay in one place but that isn't all I need it to do. I thought that would have fixed my problem.

That might not have even made sense..

I'll try to explain it again and this is with the updated code. (the edits you suggested)

I now have the div where I want it on the page but when I make the page smaller by dragging it in the background (my layout, which the div is ontop of) moves but not the div.

I have my layout centered so when you make the window smaller the layout keeps centering itself. But the text in the div doesn't move. How can I fix that?

angus
09-21-2004, 01:55 AM
I'm pretty sure that if you want to use a <div> or <layer> tag they are not going to adjust position as the window is resized. You will need to rethink the design of your page and align your <centered> table to the left. In other words, since the div is fixed in position on the page, fix the table also, then all should be fine. I would be interested to know of any better solutions that anyone has.

Blurredream
09-21-2004, 02:03 AM
I appericate your help ^_^

I'm going to actually redraw the whole layout to make it more cleaner looking then I'm either going to slice it into tables or try divs again.

angus
09-21-2004, 02:55 AM
This site has a centered table
Demo using Flash (http://www.dauntart.com/demoflash.asp)
This is an equivalent page using divs but no flash and not centered
Demo with No Flash (http://www.dauntart.com/demo.asp)
Good Luck