...

View Full Version : Need help with alignments



Luneth
01-01-2010, 05: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 {
position:absolute;
top:211px;
left:15.3%;

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

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
-Luneth

vineet
01-01-2010, 08: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.

vineet

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

Luneth
01-01-2010, 07: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.

Excavator
01-01-2010, 08: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.

Luneth
01-02-2010, 05: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..

Excavator
01-02-2010, 08: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">
<head>
<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;
}
</style>
</head>
<body>
<div id="container">
<!--end container--></div>
</body>
</html>

Luneth
01-02-2010, 10:29 PM
Thanks, Excavator.

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum