View Full Version : Need help with alignments

01-01-2010, 04:48 AM
I'm trying to align some content & my menu to a certain spot. (more or less center)

I'm using this code:
#menu {

<div id="menu">
(menu content here)

And it aligns perfectly in the resolution I configured it on (1152x864), but on higher resolutions it's off to the left a fair bit, originally I had the left defined as pixels, I thought this was the problem and switched it to a % to find nothing changed.

Can anyone help me align this content to a certain spot for ALL resolutions?

Thanks in advance

01-01-2010, 07:41 AM
if you want to position or align your div at same position on all resolutions then you need to use absolute positioned div inside relative positioned div.

then you need to set position of your relative div, and your absolute position div will automatically move acording to it.


01-01-2010, 08:34 AM
Are you trying to align your menu centered? Can we have a link to your page?

01-01-2010, 06:23 PM
Here's a link to the page, I'm not going to include the images, but it shouldn't matter.


At the moment, the content, menu, and bottom links are mis-aligning on higher resolutions, basically anything with a left value.

01-01-2010, 07:09 PM
Hello Luneth,
The first thing you should do is get a DocType. Check out the link in my sig about doctypes.
Also look at the links about validation, they will help you.

I downloaded your code but it's not clear to me what you're trying to accomplish. That is a lot of absolute positioning and may not be the best way to do what you want done.

01-02-2010, 04:09 AM
All I want to know is how to float content in a certain spot on the background no matter what resolution one is using..

01-02-2010, 07:38 AM
In the example below, the gray box will be 30px from the top and 150px from the left of the viewport no matter what resolution the viewer is using.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
html, body {
font: 100% "Comic Sans MS";
background: #FC6;
* {
margin: 0;
padding: 0;
border: 0;
#container {
height: 600px;
width: 800px;
float: left;
margin: 30px 0 0 150px;
background: #999;
font-size: 0.8em;
<div id="container">
<!--end container--></div>

01-02-2010, 09:29 PM
Thanks, Excavator.

01-02-2010, 10:08 PM
No problem Luneth, Happy New Year!