Center an Html page with CSS
Posted
by csmith18119
on Geeks with Blogs
See other posts from Geeks with Blogs
or by csmith18119
Published on Tue, 04 Dec 2012 19:16:11 GMT
Indexed on
2012/12/05
5:06 UTC
Read the original article
Hit count: 416
I always have to google this whenever I need it. So instead of searching every time I am putting it here. I originally got this from Reign Water Designs.
Check the link here:
http://www.reignwaterdesigns.com/ad/tidbits/hacks/css_center.shtml
First
This will only work if the DOCTYPE is XHTML Transitional or Strict. IT WILL NOT WORK if your doctype is HTML 4.x. Here is an example of what it should look like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
NEXT!
Put this at the top of your CSS file.
#html, body { top: 0px; right: 0px; bottom: 0px; left: 0px; width:980px; height: 100%; margin: auto; }
© Geeks with Blogs or respective owner