Webpage is showing Center in Firefox and Opera but showing left aligned in IE

Discussion in 'HTML & Website Design' started by informationHell, Aug 4, 2009.

  1. #1
    hello,
    i am modifying a simple css template but i noticed that 2 of the pages are showing as left aligned in IE but are showing perfectly centered in firefox and in Opera!

    rest of the pages are fine in IE but this aligning problem is in only 2 of the pages...

    how can i aligned these two pages to show as Centered in IE too?

    :confused:
     
    informationHell, Aug 4, 2009 IP
  2. EnhanceSEO

    EnhanceSEO Active Member

    Messages:
    170
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #2
    On your main body container (or the div that holds everything together) try adding this:

    margin: 0px auto;

    This should centre align everything.
     
    EnhanceSEO, Aug 4, 2009 IP
  3. jamieellis

    jamieellis Active Member

    Messages:
    427
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #3
    text-align:center; should center align all child elements in IE.
     
    jamieellis, Aug 4, 2009 IP
  4. informationHell

    informationHell Peon

    Messages:
    931
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #4
    this is the css file:

    
    *{
    	margin:0;[B] ---> margin: 0px auto; (i changed it but didnt worked)[/B]
    	padding:0;
    	border:0;
    }
    body{
    	background:#000;
    	font:12px verdana;
    	color:#fff;
    }
    .clear{
    	clear:both;
    }
    #wrapper{
    	width:780px;
    	margin:0 auto;
    }
    #header{
    	width:780px;
    	height:167px;
    	background:url(img/header_bg.gif) repeat-x;
    	
    
    }
    .logo{
    	width:249px;
    	height:109px;
    	float:left;
    }
    .logo h2{
    	display:none;
    }
    .ads{
    	width:250px;
    	height:33px;
    	float:right;
    	margin:0 13px 0 0;
    }
    .menu{
    	position:relative;
    	padding:0 0 0 24px;
    	margin:0 auto 0 auto;
    	height:52px;
    	list-style:none;
    	width:780px;
    	background:#000;
    	line-height:42px;
    }
    .menu li{
    	float:left;
    	list-style:none;
    	margin:0 5px;
    }
    .menu li a{
    	float:left;
    	display:block;
    	color:#717171;
    	text-decoration:none;
    	font-family:sans-serif;
    	font-size:12px;
    	font-weight:bold;
    	padding:0 0 0 12px;
    	height:52px;
    	cursor:pointer;	
    }
    .menu li a b{
    	float:left;
    	display:block;
    	padding:0 24px 0 12px;
    }
    .menu li.current a{
    	color:#7b9900;
    	background:url(img/menu_hover_left.gif) no-repeat;
    	background-position:left;
    }
    .menu li.current a b{
    	color:#7b9900;
    	background:url(img/menu_hover_right.gif) no-repeat;
    	background-position:right;
    	height:52px;
    	line-height:32px;
    }
    .menu li a:hover{
    	color:#7b9900;
    	background:url(img/menu_hover_left.gif) no-repeat;
    	background-position:left;
    	line-height:34px;
    }
    .menu li a:hover b{
    	color:#7b9900;
    	background:url(img/menu_hover_right.gif) no-repeat;
    	background-position:right;
    	height:52px;
    }
    #banner{
    	width:780px;
    }
    #container{
    	background:#242426;
    	width:780px;
    	font:12px verdana;
    	color:#717171;
    }
    .left{
    	width:550px;
    	float:left;
    	padding:0 0 5px 10px;
    }
    .left h2{
    	font-size:16px;
    	font-family:Verdana, Arial, Helvetica, sans-serif;
    	font-weight:bold;
    	color:#bad709;
    	margin:8px 0 5px 0;
    }
    .left p{
    	font-size:12px;
    	font-family:Verdana, Arial, Helvetica, sans-serif;
    	color:#717171;
    	line-height:22px;
    	margin:10px 0;
    }
    .divider{
    	background:url(img/divider.gif) no-repeat center center;
    	width:5px;
    	height:252px;
    	float:left;
    }
    .right{
    	width:215px;
    	float:right;
    }
    .right h2{
    	font-size:16px;
    	font-family:Verdana, Arial, Helvetica, sans-serif;
    	font-weight:bold;
    	color:#bad709;
    	margin:10px 0 10px 10px;
    }
    .right p{
    	margin:5px 0 5px 14px;
    }
    #footer{
    	width:780px;
    	height:40px;
    	font-size:11px;
    	font-family:Verdana;
    	color:#717171;
    }
    #footer a{
    	font-size:11px;
    	font-family:Verdana;
    	color:#717171;	
    	text-decoration:none;
    }
    #footer a:hover{
    	text-decoration:underline;
    }
    #footer ul{
    	list-style:none;
    	margin:6px auto;
    	text-align:center;	
    }
    #footer li{
    	display:inline;
    	list-style:none;
    	font-size:11px;
    	font-family:Verdana;
    	color:#717171;	
    }
    #footer li a{
    	font-size:11px;
    	font-family:Verdana;
    	color:#717171;
    	text-decoration:none;
    	padding:0 10px;
    }
    #footer li a:hover{
    	text-decoration:underline;
    }
    #footer p{
    	font-size:11px;
    	font-family:Verdana;
    	color:#717171;
    	text-align:center;
    	margin:5px 0 0 0;	
    }
    Code (markup):

    tried text-align:center too... but but only the text in the page got shifted to center not the whole webpage :(
     
    informationHell, Aug 4, 2009 IP