www.webdeveloper.com
Results 1 to 5 of 5

Thread: How do I center my websites

  1. #1
    Join Date
    May 2005
    Posts
    2

    How do I center my websites

    I use Dreamweaver MX. I'm not as proficient at HTML as I should be. Could anyone tell me the code to center my webpages and where to place the code? I thought all I needed was <center> at the top of the body and </center> at the end, but this doesn't seem to work.

  2. #2
    Join Date
    Oct 2005
    Location
    Cambridgeshire, UK
    Posts
    88
    I'd avoid using <center> tags if possible as they are deprecated in HTML 4.0 and beyond.

    Instead try...
    Code:
    <div align="center"></div>
    ...or even...
    Code:
    <div style="text-align:center;"> </div>
    The following links are a blatant plugging attempt...
    http://www.stneotsfc.com
    http://www.ikonforums.com

  3. #3
    Join Date
    Jun 2005
    Location
    United Kingdom
    Posts
    1,043
    I'd use styling, seting left and right margin widths to auto. But if IE5 users browse your site, see here

  4. #4
    Join Date
    Jun 2004
    Location
    4846′36″ N 910′48″ E
    Posts
    3,747
    assign a fixed width to the parent block element and give it an "auto" margin for both left and right
    PHP Code:
    <div style="width: 800px; margin: 0 auto;">
        
    //content
    </div

  5. #5
    Join Date
    Oct 2005
    Location
    Cambridgeshire, UK
    Posts
    88
    Hang on, this is a duplicate thread, see also: http://webdeveloper.com/forum/showthread.php?t=83290
    The following links are a blatant plugging attempt...
    http://www.stneotsfc.com
    http://www.ikonforums.com

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