Jump to content

Absolute positioning problem


son

Recommended Posts

I have a container as:#container {position:absolute;top:50%;left:50%;height:600px;width:800px;margin-top:-300px;margin-left:-400px;}which centers the container on pageThen I have a div for copyright as:#copy {position:absolute; height:auto; top:auto; margin-top:auto; bottom:3px; margin-bottom:0; right:6px;}which keeps copyright on right bottom side.Now my problem: the copyright info comes up on larger screens. How can I center and middle align my main container while making sure the copyright is in right bottom corner or even lower down if content extends the height of container? It looks rather odd when it is hanging in the air...Son

Link to comment
Share on other sites

  • 5 weeks later...

Hmm... I don't really get it, but I'd suggest you use the following code, in order to centre the page. Also, you can play with the width attribute, but 780px is recommended as a resolution optimization (if the user uses 800x600, he won't be needed to scroll left/right).

#container {margin: 0 auto;width: 780px;}

As for the copyright, I don't get it: is it used to position text, or is it a whole DIV?

Link to comment
Share on other sites

23.12.2012, margin: 0 auto does not work with absolute positioning. Son's centering method is the normal method (and the only one I know that works) for centering absolutely positioned items.Son, look into position: fixed for that copyright.

Link to comment
Share on other sites

WITH ABSOLUTE POSITIONING. I thought he did not know of this method, so that's why he tried to make up some code to work with this positioning.

Link to comment
Share on other sites

23.12.2012, margin: 0 auto does not work with absolute positioning. Son's centering method is the normal method (and the only one I know that works) for centering absolutely positioned items.Son, look into position: fixed for that copyright.
Thanks for your input! Will have a go...Son
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...