Results 1 to 7 of 7

Thread: Center a page

  1. #1
    Join Date
    Nov 2007
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Center a page

    Please help! I would like to center this page, http://www.afesports.com/indexxxxx.php like msn.com

    Thanks you!

  2. #2
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    Does margin: auto; fail? I can't find it in your CSS, so I'm not sure.

  3. #3
    Join Date
    Nov 2007
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well, I do have it, and this is the CSS code
    HTML Code:
    <style type="text/css"> 
    <!-- 
    body  {
    	color: #333; 
    	width: 95%;
    	min-width: 900px;
    	margin: auto;
    	font-family: Verdana;
    	text-align:center;
    	background-image: url(images/bg.gif);
    	background-repeat: repeat-x; 
    	padding: 0;
    	font-size: 70%;
    }
    .twoColFixRtHdr #container { 
    	margin: 0px; /* the auto margins (in conjunction with a width) center the page */
    	text-align: left; /* this overrides the text-align: center on the body element. */
    } 
    .twoColFixRtHdr #header {
    	padding: 0 5px 0 10px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
    	height: 100px;
    } 
    .twoColFixRtHdr #header h1 {
    	margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
    	padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
    }
    
    .twoColFixRtHdr #menu { 
    	padding: 0 0px 0 0px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
    	height: 85px;
    } 
    
    /*START - YOU ARE HERE*/
    .twoColFixRtHdr #youarehere { 
    	margin: 0 0 0 200px; /* the right margin on this div element creates the column down the right side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
    		background: url(images/headerbg.gif) repeat-x;
    	border:0px solid #b6b6b7;
    	padding:0px;
    	height: 25px;
    	color: #FFFFFF;
    } 
    
    /*START - LEFT COLUMN*/
    .twoColFixRtHdr #leftcolumn { 
    	margin: 0 0 0 0; /* the right margin on this div element creates the column down the right side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
    	float: left;
    	border:0px solid #b6b6b7;
    	width: 200px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */
    	max-width: 200px;
    	height: auto;
    	background: #F7F7F7; 
    } 
    
    .twoColFixRtHdr #mainContent { 
    	margin: 0 0 0 200px; /* the right margin on this div element creates the column down the right side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
    	padding: 10px 10px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
    	background: #ffffff;
    } 
    .twoColFixRtHdr #mainContent h1 { 
    font-size: 150%;
    } 
    
    
    .twoColFixRtHdr #subfooter { 
    	padding: 0 5px 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
    	background-image: url(images/subheaderbg.gif);
    	height:25px;
    	color:#333333;
    } 
    
    .twoColFixRtHdr #footer { 
    	padding: 0 5px 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
    	background-image: url(images/headerbg.gif);
    	height:25px;
    	color:#FFFFFF;
    } 
    .twoColFixRtHdr #footer p {
    	margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
    	padding: 5px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
    }
    .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
    	float: right;
    	margin-left: 8px;
    }
    .fltlft { /* this class can be used to float an element left in your page */
    	float: left;
    	margin-right: 8px;
    }
    .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
    	clear:both;
        height:0;
        font-size: 1px;
        line-height: 0px;
    }
    /************************************/
    /*Right Column*/
    /************************************/
    .rightTop {
    	background: url(images/headerbg.gif) repeat-x;
    	font-weight:bold;
    color: #FFFFFF;
    height: 23px;
    padding-top: 2px;
    padding-left: 2px;
    }
    
    .right_cats {
    text-align:center;
    }
    
    .rightBack {
    	background:#F7F7F7;
    	padding:6px;
    }
    
    .rightBacking {
    	background:#ecebeb;
    	border:1px solid #c3c3c3;
    }
    .rightBottomRight {
    	padding:0;
    	color:#fff;
    	height:14px;
    }
    	
    .rightBottomLeft {
    	margin:0;
    	height:14px;
    	margin-right:26px;
    }
    
    /*Link Styles*/
    A:link	{
    color:#355999;
    font-weight:bold;
    	}
    A:hover	{
    font-weight:bold;
    text-decoration: underline;
    	}
    A:active	{
    color:#355999;
    font-weight:bold;
    	}
    A:visited	{
    color:#355999;
    font-weight:bold;
    	}
    
    -->
    
    /*SHARE*/
    .share {
    	background: url(images/sharebg.gif) repeat-x;
    	font-weight:bold;
    color: #FFFFFF;
    width: 350px;
    height: 25px;
    }
    
    
    
    </style><!--[if IE 5]>
    <style type="text/css"> 
    /* place css box model fixes for IE 5* in this conditional comment */
    .twoColFixRtHdr #sidebar1 { width: 220px; }
    </style>
    <![endif]--><!--[if IE]>
    <style type="text/css"> 
    /* place css fixes for all versions of IE in this conditional comment */
    .twoColFixRtHdr #sidebar1 { padding-top: 30px; }
    .twoColFixRtHdr #mainContent { zoom: 1; }
    /* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
    </style>
    <![endif]-->
    Last edited by afe; 02-25-2008 at 12:28 AM.

  4. #4
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    Please point it out to me. I see 0, 26px, 0px. etc. but no auto.

  5. #5
    Join Date
    Nov 2007
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    <!--
    body {
    color: #333;
    width: 95%;
    min-width: 900px;
    margin: auto;
    font-family: Verdana;
    text-align:center;
    background-image: url(images/bg.gif);
    background-repeat: repeat-x;
    padding: 0;
    font-size: 70%;
    }

  6. #6
    Join Date
    Nov 2007
    Posts
    346
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Wait never mind, it worked, Thanks!

  7. #7
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    Ok. (FireFox search gets my failing grade... searching for margin picked up all but the top one. WTH. I looked through it myself but missed it I suppose.)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •