Username:

Password:

Author Topic: Centering web page  (Read 1283 times)

InternetPrezentacija

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 9
    • WWW
Centering web page
« on: August 08, 2009, 02:49:48 AM »
How to center my web page horizontally in web browser window. Which is the best method?
Logged
Kvalitetna izrada web internet prezentacija Srbija je funkcionalna kada je izrada web internet prezentacija Novi Sad Srbija u pitanju na informativno zaglavlje, delatnost firme

chase

  • WebDes1gn Staff
  • Administrator
  • Full Member
  • *****
  • Karma: +100/-0
  • Posts: 110
    • WWW
Re: Centering web page
« Reply #1 on: August 08, 2009, 12:08:15 PM »
CSS


parent container with a margin: 0 auto;

soumali

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
Re: Centering web page
« Reply #2 on: September 15, 2009, 01:51:27 AM »
This is a very simple thing to do with CSS. Here's all you need:

<body>  <div id="wrapper">   ...  </div> </body>
In this example, the div with the id of "wrapper" is what we want to make centered and fixed width. Now for the CSS:


body {  margin: 0;  padding: 0;  text-align: center; } #wrapper {  margin: 0 auto;  border: 1px solid red;  padding: 0;  width: 720px;  text-align: left; }
Then within your wrapper, just fill it in with your content. Hope that helps.






Web Site Promotions
Logged

chase

  • WebDes1gn Staff
  • Administrator
  • Full Member
  • *****
  • Karma: +100/-0
  • Posts: 110
    • WWW
Re: Centering web page
« Reply #3 on: September 18, 2009, 01:07:35 PM »
Great code example soumali!

seomayuri

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
Re: Centering web page
« Reply #4 on: October 20, 2009, 09:21:42 PM »
Another method is also here,

when you are using tables,
<body>
<table align=center width=800 border=0><tr><td><h1> Webpages in center</h1></td></tr></table>
</body>
Logged

danidallia123

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 1
Re: Centering web page
« Reply #5 on: May 17, 2010, 11:06:16 PM »
The mark up is simple and consists of two structural divs - one container div, and another to hold.

1   <div id="outer">
2     <div id="inner">
3       [content here]
4     </div>
5   </div>

The CSS:

01   #outer {
02     position: absolute;
03     top: 50%;
04     left: 0px;
05     width: 100%;
06     height: 1px;
07     overflow: visible;
08   }
09   
10   #inner {
11     width: 300px;
12     height: 200px;
13     margin-left: -150px;  /***  width / 2   ***/
14     position: absolute;
15     top: -100px;          /***  height / 2   ***/
16     left: 50%;
17   }

Web Design Chennai
Logged

regueradela

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 5
Re: Centering web page
« Reply #6 on: July 12, 2010, 02:34:14 AM »
You can also put like this way for center page.

<head>
</head>
<title>
<body bgcolor="#111111" leftmargin="40">
<center>
<table id="Table_2" width="766" height="780" border="1" cellpadding="1.5" cellspacing="1">
</title>..
« Last Edit: July 21, 2010, 01:19:17 AM by regueradela »
Logged