www.webdeveloper.com
Results 1 to 12 of 12

Thread: Centering Layout

  1. #1
    Join Date
    Feb 2006
    Posts
    78

    Centering Layout

    hey can someone tell me the best way to center this website?
    http://greyfilmpro.com/steve/index I attached the style sheet.
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2005
    Location
    The best country in the world, Texas!
    Posts
    251
    first, change all your absolute positioning to relative, then add to your CSS:

    PHP Code:
    BODY margin0 autowidth999px; }
    /* change width to match width of content area of your page */ 
    WARNING: Use code provided at your own risk!

  3. #3
    Join Date
    Jun 2006
    Posts
    45
    couldn't you just add <center></center> after and before the body tags?

  4. #4
    Join Date
    Feb 2006
    Posts
    78
    so where does that code go? the body one

  5. #5
    Join Date
    Jun 2006
    Posts
    45

    Okay here's an example:
    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD>
    
    <BODY> <--Here are the body tags
    <cemter>  <-- try placing the center code here
    
    ...
    Website code here
    more website code here
    ...
    
    </center> <--and the close center tag here
    </BODY> <--Here are the body tags
    </HTML>
    Who likes bright blue fonts?? I DO!!! (but Cytael doesn't...)
    -----------
    Visit my Programmers Forum, Active_VB, here.

  6. #6
    Join Date
    Feb 2006
    Posts
    78
    nope that doesnt work TehShlocker.

  7. #7
    Join Date
    Jun 2006
    Posts
    27
    are you using tables? Center your whole table(s)

  8. #8
    Join Date
    Feb 2006
    Posts
    78
    no im using layers not tables.

  9. #9
    Join Date
    Dec 2005
    Location
    American, living in Toronto, ON. CANADA
    Posts
    6,746
    Quote Originally Posted by GreyFilmPro
    hey can someone tell me the best way to center this website?
    http://greyfilmpro.com/steve/index I attached the style sheet.
    Don't use "<center>"~"</center>". This is deprecated (old, out-of-date) and is you use a STRICT !doctype, you'll throw errors.

    Surround your page with a DIV. Let's call this a 'wrapper'.

    <body>
    <div style="width:90%; margin:0 auto;"><!-- wraps entire page content from opening BODY tag, to closing BODY tag -->

    -Your site content goes in here-

    </div><!-- end WRAPPER -->
    </body>

    This works, and is valid. But in order to have auto-adjusting left-right margins ("centering"), you must also declare a width. I chose 90%, but you can make it whatever you want.

    -Joel

  10. #10
    Join Date
    Feb 2006
    Posts
    78
    I did that but it still isnt centering.....

  11. #11
    Join Date
    Jun 2006
    Location
    Iowa
    Posts
    88
    did you even try what cytael said before about the body?
    Firefox|Arch Linux
    "Wealth is the product of man's capacity to think." - Ayn Rand

  12. #12
    Join Date
    Feb 2006
    Posts
    78
    yes I did, Ive tried every suggestion on this page and nothing has worked.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles