www.webdeveloper.com
Results 1 to 7 of 7

Thread: Center Page in all 'Platforms'

  1. #1
    Join Date
    Mar 2005
    Posts
    29

    Center Page in all 'Platforms'

    I am looking to see if there is any way i can center my page in all platforms(wrong word sorry, but i can't think of how to say it)? (IE, Mozilla...ect.) anyone know how?
    BroadBandReports.com

  2. #2
    Join Date
    Feb 2003
    Location
    Wales, UK
    Posts
    3,148
    tables or css?
    using css you need margin: auto; on the element to be centered and text-align: center as the work around for IE.
    In a world without walls and fences - who needs Windows and Gates?! - Unknown Author
    "And there's Bill Gates, the...most...famous...man in the...ah...Microsoft." -- A TV commentator for the 2000 Olympics.


    Web Design Faq? | W3C | Validator | Accessibility testing | Speed up your PC | Wura | Box Model Research

  3. #3
    Join Date
    Mar 2005
    Posts
    29
    I mainly use tables. Considering im fairly new to this and that is the easiest thing.
    BroadBandReports.com

  4. #4
    Join Date
    Feb 2003
    Location
    Wales, UK
    Posts
    3,148
    obviously CSS is better than tables, but try using

    <table style="margin: auto; text-align: left;">
    (as in, add the style section into your table tag)

    Then put a div around the entire page with text-align: center;

    <div style="text-align: center;">
    your table and page contents
    </div>

    On the other hand, if you aren't concerned at all about accessibility and just posted in the wrong forum, nest a table round the lot and centrally align the table inside it. Nested tables are a bad idea though...
    In a world without walls and fences - who needs Windows and Gates?! - Unknown Author
    "And there's Bill Gates, the...most...famous...man in the...ah...Microsoft." -- A TV commentator for the 2000 Olympics.


    Web Design Faq? | W3C | Validator | Accessibility testing | Speed up your PC | Wura | Box Model Research

  5. #5
    Join Date
    Apr 2005
    Location
    Hastings, Sussex, UK.
    Posts
    244
    IE5 is a problem here though. You'll need to specify "text-align: center;" to the BODY. On the containing DIV, set "margin-left:auto;margin-right:auto;" to get the widest possible consistency as some browsers don't get shorthand CSS.

  6. #6
    Join Date
    Feb 2003
    Location
    Wales, UK
    Posts
    3,148
    The code I provided works perfectly in IE4 upwards.
    In a world without walls and fences - who needs Windows and Gates?! - Unknown Author
    "And there's Bill Gates, the...most...famous...man in the...ah...Microsoft." -- A TV commentator for the 2000 Olympics.


    Web Design Faq? | W3C | Validator | Accessibility testing | Speed up your PC | Wura | Box Model Research

  7. #7
    Join Date
    Apr 2005
    Location
    Hastings, Sussex, UK.
    Posts
    244
    Quote Originally Posted by DaveSW
    The code I provided works perfectly in IE4 upwards.
    Aye it does, although BODY is also a container that should be appropriately styled according to the contents and their positioning requirements.

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