www.webdeveloper.com
Results 1 to 4 of 4

Thread: Centering content in Netscape 7, Opera 7.51 and Firefox 0.9

  1. #1
    Join Date
    Jun 2004
    Posts
    4

    Centering content in Netscape 7, Opera 7.51 and Firefox 0.9

    After searching forums etc it seems that the accepted way of centering content is something along the following lines:

    /*Division tags*/
    body {
    color: #000;
    background: #fff;
    text-align: center;
    margin: 0px;
    padding: 0px; /* Keeps Opera in check */
    }

    #main {
    position: relative;
    margin: 10px auto 10px auto;
    padding: 0px;
    width: 720px;
    height: auto;
    text-align: center;
    }


    However this does not work for the browsers listed in the subject, the content appears on the left and infact dissapears entirely in netscape when the window size shrinks. Any ideas?

  2. #2
    Join Date
    Dec 2003
    Location
    UK
    Posts
    1,141
    Try changing the margin in the main div to this margin:0 auto;

  3. #3
    Join Date
    Mar 2004
    Location
    Maine
    Posts
    473
    i believe you can also say

    margin-left: auto;
    margin-right: auto;

    But I forget lol.

  4. #4
    Join Date
    Jan 2004
    Location
    United Kingdom
    Posts
    610
    Code:
    body {
    color: #000;
    background: #fff;
    text-align: center;
    margin: 0;  /* for null value, you do not need to put the units in */
    padding: 0;
    }
    
    #main {
    position: relative; /* no need for this */
    margin: 10px;
    margin-left: auto;
    margin-right:auto;
    padding: 0px;
    width: 720px;
    height: auto;
    text-align: center;
    }
    Opera is not familiar with the margin: 10px auto et cetera so you can get around it as above.

    Hope that helps.
    Best Wishes,
    David

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