Centered Fixed Width Question

Discussion in 'CSS' started by onestop, Sep 26, 2007.

  1. #1
    Hi
    Our site has a 904px fixed width, and centered. It works great at firefox, but at internet explorer, it opens 100% width first, then starts shrinking to 904px.

    It looks terrible while the site is loading with all shrinking, especially if the user's internet connection is slow.

    I'd appreciate if anybody can help to solve this with css.

    Thanks in advance
    site: www.turkishcorner.com
     
    onestop, Sep 26, 2007 IP
  2. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Wow, that looks pretty neat! My colleague and I looked on in shock and awe as we watched the site slowly move around like the Mosiac game.

    Seriously though, it might be that Javascript in the beginning with some sort of funky resize commands for Nav4... seriously, does anyone in Tukiye use Netscape Navigator?? Maybe somehow IE is doing something with that js.

    You have 4 css pages, and I didn't see anything in any of them that meant anything. Your site uses tables and not CSS for the positioning.

    If anyone else figures out what's doing it for sure, I'd sure like to keep it handy in case I want to use that! Though I suspect tables set the way the site resizes, as browsers load tables in chunks.
     
    Stomme poes, Sep 26, 2007 IP
  3. onestop

    onestop Well-Known Member

    Messages:
    534
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    138
    #3
    Thank you for taking a look. I've removed the javascript:

    <script language="JavaScript" type="text/JavaScript">
    <!--
     
    function MM_reloadPage(init) {  //reloads the window if Nav4 resized
      if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
      else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);
    //-->
    </script>
    Code (markup):
    I don't think it has anything to do.

    Site starts with a fixed table:

    <body>
    <table width="904" border="0" align="center" cellpadding="0" cellspacing="0">
    Code (markup):
    I always make my sites like this (fixed width table).

    Is there any css trick to prevent this problem?

    I can pay somebody for this if it's tricky and I can't do it myself.

    still waiting for answers...
     
    onestop, Sep 26, 2007 IP
  4. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well, here's a stab in the dark:

    In your css files you don't have any positioning on anything, just colours and fonts etc.

    I wonder if, maybe, the align="center" isn't looked at by IE until after it has rendered the tables??

    You could have a duplicate in CSS (I dunno if they would conflict in other browsers) that centers the main table. But since you really only want the main big table centered, you'd have to give it a name.

    Try (for ONLY the first table on your page, the containing table)
    <table id="containertable">

    and in the CSS
    #containertable {
    margin: 0 auto;
    width: 904px; <--- I think this is optional, but add it anyway
    }

    This is supposed to tell the browser that this thing (containertable) is supposed to have no margins on top of bottom but an equal amount of space on each side.

    Maybe IE will look at that CSS sheet first instead of waiting until all the tables are loaded??

    That's the best thing I can think of...
     
    Stomme poes, Sep 26, 2007 IP
    onestop likes this.
  5. onestop

    onestop Well-Known Member

    Messages:
    534
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    138
    #5
    Thanks a lot for your comments and time.

    I've added this before your comments:

    <table width="904" border="0" align="center" cellpadding="0" cellspacing="0" style="width:904px; table-layout:fixed">
    Code (markup):
    with this addition: style="width:904px; table-layout:fixed">

    at least it starts with a 904px table, but the <td> columns shrink again. I'll play with it. I'd appreciate any other support/help.

    thanks again. rep added.
     
    onestop, Sep 26, 2007 IP
  6. Crimsonc

    Crimsonc Peon

    Messages:
    616
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You've given the columns % values and until everything is loaded in the columns IE doesn't know how much say... 2% is. Give them fixed width values in pixels and you'll solve it!
     
    Crimsonc, Sep 27, 2007 IP
  7. jared

    jared Peon

    Messages:
    231
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Just create a ID or class in your stylesheet and assign to the table and you won't need all that stuff in the line

    #maintable {
    width: 904px;
    border: 0;
    margin: 0 auto;
    }

    then just have <table id="maintable" [...] >
     
    jared, Sep 27, 2007 IP
  8. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Crimson,

    How does FF/O/etc know what 2% is before the table is loaded?

    In my FF, the top image/table loads first, and then the rest of the page.
     
    Stomme poes, Sep 27, 2007 IP
  9. Crimsonc

    Crimsonc Peon

    Messages:
    616
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #9
    it's a best guess, try it and see what happens. The very idea of a fixed width page is it's got a set size, 2% is variable depending on browser size and such. Anyway thats the way tables load, if you have several separate tables each is loaded one at a time, which is why going table less is a good idea.

    I don't know if you can prevent it or not, my suggestion was a best guess.
     
    Crimsonc, Sep 28, 2007 IP