View Full Version : DIV's move around the page when browser is resized

29 Jan 2010, 03:37 PM
Hey guys! I'm new at this whole web design thing.. but I'm trying to work on this website but the DIV i made with text in it moves around anytime i resize the window. Help?

here is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<title>KILL THE DESIGN</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />

<link href="style.css" rel="stylesheet" type="text/css" />

<style type="text/css">



border:solid 0px #000000;

<script type="text/javascript">
// written by: Coothead
function updateObjectIframe(which){
document.getElementById('one').innerHTML = '<'+'object id="foo" name="foo" type="text/html" data="'+which.href+'"><\/object>';



<div id="one">
<object id="foo" name="foo" type="text/html" data="home.html"></object>


<div id="container">
<div id="banner"></div>

<div id="sidebar">

<a href="home.html" class="nav" onclick="updateObjectIframe(this); return false;">Home</a>
<a href="about.html" class="nav" onclick="updateObjectIframe(this); return false;">About</a>
<a href="gallery.html" class="nav" onclick="updateObjectIframe(this); return false;">Gallery</a>


<div id="sidebar2">

<a href="contact.html" class="nav" onclick="updateObjectIframe(this); return false;">Contact Us</a>
<a href="links.html" class="nav" onclick="updateObjectIframe(this); return false;">Links</a>
<a href="order.html" class="nav" onclick="updateObjectIframe(this); return false;">Order</a>


<div id="copyright">
<br />
Kill The Design 2009
<br />
<a href="#">Credit</a>

<br /><br />



01 Feb 2010, 06:26 AM
Hi katrinkamille,

Welcome to the world of web design ... and you've run straight into the problem that most new people meet!

Publishing to web browsers is quite simply not the same as publishing to paper. Browser types, sizes, resolutions and local stylesheets make the designers attempts to make the page display "how they want" a really hard task. Therefore, understanding and getting the flow of the elements within a page correct is the first tutorial.

To be honest I think you need to start with a much simpler example that the one above. Try generating the code yourself rather than borrowing other peoples; it will ensure you understand it more fully.

http://www.w3schools.com is a great place to start.

As far as I can tell from your coding above the absolute positioned element is anchored to the right of the browser window (right: 205px) so I would expect it to move with the browser frame.

Try working on the element flow and steering clear (for now, if not for ever!) the idea of absolute positioned elements.

I hope that helps; it is a steep learning curve at first but trust me it soon starts to flatten out.

Good luck.