Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: The align property does not seem to work correctly in Firefox

  1. #1
    Join Date
    Jul 2006
    Location
    UK
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default The align property does not seem to work correctly in Firefox

    I am trying to get the main table to sit in the centre of the page, it works in IE but not in Firefox. When I preview in Firefox, the table sits on the left of the page. How do I get the table to sit in the middle of the page in Firefox like it does in IE?

    Here's the code I have so far:

    HTML Code:
    <!-- Main table -->
    <table class="main_table" width="800" border="0" cellspacing="0" cellpadding="0" align="center">
      <tr>
        <td><!-- Header --><table width="800" height="250" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td valign="top" align="left"><img src="img/shimmyst_green_header.gif" width="800" height="250" /></td>
      </tr>
    </table><!-- END Header -->
    </td>
      </tr>
      <tr>
        <td><!-- Blog List --><table class="blog_list" width="800" height="30" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table><!-- END Blog List -->
    </td>
      </tr>
      <tr>
        <td><!-- Main Content Body --><table width="800" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="200">&nbsp;</td>
        <td width="400">&nbsp;</td>
        <td width="200">&nbsp;</td>
      </tr>
    </table><!-- ND Main Content Body -->
    </td>
      </tr>
      <tr>
        <td><!-- Footer --><table width="800" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table><!-- END Footer -->
    </td>
      </tr>
    </table>
    <!-- END Main Table -->
    Obviously I have the relevant head and body tags, I'm just showing you the main table with nested tables here. I am fairly new to coding and have been teaching myself. I also am using a CSS stylesheet, and as far as I can see I don't think I can get the table to align to the centre of the page by using CSS, but if there is a way then I'll be happy to know about it.

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Just helping someone else with a similar problem, and it seems that yes it can be solved by CSS...

    These are the links I gave the other member to look over:

    http://www.dynamicdrive.com/forums/s...ead.php?t=9202

    http://www.dynamicdrive.com/forums/s...ead.php?t=6648

    http://www.dynamicdrive.com/forums/s...ead.php?t=4735

    On that last one, pay particular attention to the last post (by Mike)
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    <div align="center">
    <!-- table code goes here -->
    </div>
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Jul 2006
    Location
    UK
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, the div tag worked. I'm not knowledgable about div tags so I will look at that in more detail.

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Well... not sure what the align is doing in the table.... not sure why it's not working. The align can either align the contents of the table, or align the item itself... not sure which it was doing in that case (i think in the table command it does the table and in the td (cell) command it does the contents, but... not sure).
    Anyway, just putting it inside something will make everythign in that div centered, including the table... so... yeah.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The align property is deprecated, and should be replaced with the CSS text-align. However, this applies only to inline elements. Block-level elements such as tables should be centred by setting both their left and right margins to auto.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Jul 2006
    Location
    UK
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Okay the auto property worked but in DreamWeaver it says it's not supported by Netscape and I'd like to have my layout be supported by all major browsers if possible.

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Insofar as I'm aware, it's wrong.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Jul 2006
    Location
    UK
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    So DreamWeaver is not correct?

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I wouldn't be at all surprised. Don't sound so incredulous, it's not perfect -- in fact, far from it.

    Setting the horizontal margins to auto is the pretty-much-universally-accepted way of centring block-level elements. If Netscape doesn't support the "auto" value for margins, a lot of the web is going to look very messed up in it.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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