center layout
Posted: 26 November 2007 12:47 AM   [ Ignore ]
Newbie
Rank
Total Posts:  2
Joined  2007-11-26

I want my website layout to have a fixed width, but always be centered in the browser. I know that top and left is default. How do I make the main container go top and center?

Profile
 
 
Posted: 26 November 2007 12:21 PM   [ Ignore ]   [ # 1 ]
Member
Avatar
RankRankRank
Total Posts:  52
Joined  2007-11-08

if you gave a link to the page you’re working on, it’s always better than any detailed explanation :-)

body
{
  margin
:0 auto;
  
text-align:center;
}

div
#layout
{
  margin
:0 auto;
  
text-align:left;


Above are the modifications you need to make/add to your css..

Regards,

Profile
 
 
Posted: 26 November 2007 11:06 PM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  2
Joined  2007-11-26

Thanks. It’s working in Explorer, but things are still going to the default left in Mozilla.

Any other ideas?

Profile
 
 
Posted: 27 November 2007 03:10 AM   [ Ignore ]   [ # 3 ]
Member
Avatar
RankRankRank
Total Posts:  52
Joined  2007-11-08
nouks1 - 26 November 2007 11:06 PM

Thanks. It’s working in Explorer, but things are still going to the default left in Mozilla.

Any other ideas?

Given a specific width and margin:0 auto; it should be working on mozilla too..you must be having some other css attributes that intefere..you may paste your code here or give a link to your web page so i can tell you where the problem is exactly..

Regards,

Profile
 
 
Posted: 05 March 2008 10:08 PM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  26
Joined  2008-03-05

TRY THIS

body { margin0text-aligncenter;}

div
#layout
{
  margin
:0 auto;
  
text-align:left;
Profile
 
 
Posted: 07 March 2008 11:55 AM   [ Ignore ]   [ # 5 ]
Member
Avatar
RankRankRank
Total Posts:  52
Joined  2007-11-08

If am not mistaken, i already gave this solution :)

6StringRazor - 05 March 2008 10:08 PM

TRY THIS

body { margin0text-aligncenter;}

div
#layout
{
  margin
:0 auto;
  
text-align:left;
Profile
 
 
Posted: 07 March 2008 01:17 PM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  26
Joined  2008-03-05

It looks like the same solution but it is not -
your body is definded——> body { margin:0 auto; text-align:center; }

mine is a tiny bit different—-> body { margin: 0; text-align: center;}

Thanks

Profile
 
 
Posted: 07 March 2008 01:23 PM   [ Ignore ]   [ # 7 ]
Member
Avatar
RankRankRank
Total Posts:  52
Joined  2007-11-08

Yes. The result is the same though, so this tiny bit difference doesn’t really make any difference.

Profile
 
 
Posted: 07 March 2008 01:34 PM   [ Ignore ]   [ # 8 ]
Newbie
Rank
Total Posts:  26
Joined  2008-03-05

let’s see what happens when he posts again - the centering issue in firefox is coming from somewhere

Profile