Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2006
    Posts
    399
    Thanks
    33
    Thanked 7 Times in 7 Posts

    problem with div align=center

    i am having problems with the property align=center on apple computers(IE, safari..), on PC everything between the div tag shows itself centered but on Machintosh everything is justify on the left;
    why is that??

    thanks




    CODE EXAMPLE:

    <div align="center">
    <table cellpadding="0" cellspacing="0" border="0" id="bio">
    <tr>
    <td>
    ...

    </tr>
    </table>
    </div>

  • #2
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    If you want the div centered in the page, you need to give it a width, otherwise it'll stretch out to the entire page… or do you mean you want the text in the div centered?

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,471
    Thanks
    6
    Thanked 980 Times in 953 Posts
    #1: Screw IE for Mac! Even Microsoft has stopped endorsement and support for that browser: http://www.microsoft.com/mac/product...ternetexplorer
    #2: You shouldn't use the HTML properties anymore (as well as you shouldn't use tables to lay out your site). CSS does the job:
    Code:
    table#bio {
      wisth: ???px;
      margin: auto;
    }
    Rule of thumb:
    Inline elements (like span, a, input, etc.) and text can be centered with text-align: center; applied to their parent element.
    Block elements (like div, table, form, etc.) can be centered with margin: auto; (they also need a width because usually they will be 100% wide by default and you wouldn't notice the centering effect).


  •  

    Posting Permissions

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