Link to home
Start Free TrialLog in
Avatar of itnifl
itniflFlag for Norway

asked on

Center Web page and drop down menues

With the code below, I will always center my webpage regardless of resolution. But then I have to position my drop down menues relatively to where certain items on the webpage er placed depending on the resolution. Today I am using absolute positioning, and that is not working when I center the webpage by the code below. Does anyone know of any good tutorials or tips on how to position a drop down menu, when the web-page is centered as shown in the code box below? Right now I am using hidden absolutely positioned div fields that are shown via a simple javascript when hovering a link, and then hidden again when the link is not hovered anymore.
body
{
	text-align: center;
}

div#container
{
	margin-left: auto;
	margin-right: auto;
	width: 50em;
	text-align: left;
}

Open in new window

Avatar of Eternal_Student
Eternal_Student
Flag of United Kingdom of Great Britain and Northern Ireland image

Do you have a working example we can look at?
Avatar of itnifl

ASKER

Yes I have, but I want to keep it to myself :) I was hoping on a general tutorial on how to position a drop down menu correctly next to an item like an link, table or div no matter the size of the browser or resolution that is used(wich affects where that item is placed).
Avatar of Jagadishwor Dulal
To center align your content use one div with margin 0 auto. And to use it will be better to use a div for menus and others Like:

#wrapper{
  width:980px; /*YOur Wrapper size*/
 margin:0 auto;
}

Open in new window

It will center align your div and you can add menus inside the div.
ASKER CERTIFIED SOLUTION
Avatar of Eternal_Student
Eternal_Student
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of itnifl

ASKER

You were right on. Obviously I don't know much about mixing relative and absolute positions. Here I undersand that if the parent div is positioned relative, then the absolute positioning within that div are measured out from that? Could you paste any links that explain this?