Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I center my web page ?? 1

Status
Not open for further replies.

HOTLIPS

Technical User
Dec 5, 2000
55
GB
Can any one help

I would like to put my web page in the center of the browser

I use div tags

Thanks
Hotlips
 
Code:
<style type="text/css">
body {
  text-align: center; /* for IE5 and IE5.5 */
}

#centered {
  width: 500px;
  margin: 0 auto; /* for all smart browsers */
  text-align: left; /* to make text not centered */
}
</style>

<body>
 <div id="centered"></div>
</body>
This will align page to the center horizontally. Vertically cannot really be done very easy, because there is no default height property (100% is invalid). Don't forget to put a complete doctype at the top of the page.
 
There is also a very useful "search" button at the top of this forum, perfect for questions like these.

*cLFlaVA
----------------------------
[tt]0101 is binary code for "supreme programmer of omnipotent power"[/tt] - adam0101
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top