Jump to content


css code for keeping a div centered at any resolution


3 replies to this topic

#1 zAchEus

    Young Padawan

  • Members
  • Pip
  • 58 posts

Posted 04 October 2007 - 05:43 AM

Hi

Whats the best way to keep your container div centered on the page at different resolutions?

thx

#2 Lastcrime

    Impatient Jedi that likes to eat cereal

  • Members
  • PipPipPip
  • 649 posts
  • Gender:Male
  • Location:Toronto, Ontario, Canada
  • Interests:Soccer, Snowboarding, Hockey, B-ball, Skateboarding, Computers!

Posted 04 October 2007 - 06:16 AM

margin:0 auto;

#3 Jacorre

    P2L Jedi

  • Members
  • PipPipPip
  • 824 posts
  • Gender:Male
  • Location:USA
  • Interests:Computers, Technology, Internet, Graphic/Web Design, Music, Soccer

Posted 04 October 2007 - 12:09 PM

In case you don't know what that means, it's setting the left and right margins to auto.

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 04 October 2007 - 01:00 PM

This is a frequently asked question, please use google/the forum search.

Note that with the margin trick, the div has to have a specified width.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users