wayward div

garrensilverwing

New Member
Messages
148
Reaction score
0
Points
0
http://war2ladder.x10hosting.com/record.php/php?player1=$paCe&player2=S9isDragon

when you look at this page in firefox or safari it looks perfectly fine, but if you look at it in IE7 or 8 (i havent checked 6 cause mine is broken for some reason) the Games div floats way off to the right. I could not tell why it was doing this :( here is my code:

PHP:
<html>
<?php
    include_once("functions.php");
    include_once("db_connect.php");
    $Player1 = $_GET['player1'];
    $Player2 = $_GET['player2'];
    $Offset = $_GET['offset'];
    if(!$Offset) $Offset = 0;
    $result = mysql_query("SELECT Winner FROM checkedgames WHERE Winner LIKE '$Player1' AND Loser LIKE '$Player2' OR Winner LIKE '$Player2' AND Loser LIKE '$Player1'") or die(mysql_error());
    $Player1Wins = 0;
    $Player2Wins = 0;
    while($row = mysql_fetch_array($result))
        {
            $GameWinner = $row['Winner'];
            if($GameWinner == $Player1) $Player1Wins = $Player1Wins + 1;
            if($GameWinner == $Player2) $Player2Wins = $Player2Wins + 1;
        }
    $Record = "Current 1v1 Record: <strong>$Player1Wins - $Player2Wins</strong>";
?>
<head>
<link rel="stylesheet" type="text/css" href="http://<?php echo $_SERVER[SERVER_NAME]; ?>/style.css" />
<title><?php echo "$Player1 - $Player2 Record * War2Ladder ";?></title>
</head>
<body>
<div id="wrapper" class="Wrapper">
<?php masthead(); ?>
<div id="stats" class="Stats">
<?php
    echo "<h3>Games between <a href=\"http://".$_SERVER[SERVER_NAME]."/player.php/php?player=$Player1\">$Player1</a> and <a href=\"http://".$_SERVER[SERVER_NAME]."/player.php/php?player=$Player2\">$Player2</a>";
    echo "<h4>$Record</h4></div>\n";
?>
    <div id="GamesWrapper" class="GamesWrapper"><div id="Games" class="Games"><h4><ul>
<?php
    $games = mysql_query("SELECT * FROM checkedgames WHERE Winner LIKE '$Player1' AND Loser LIKE '$Player2' OR Winner LIKE '$Player2' AND Loser LIKE '$Player1' ORDER BY DateT DESC LIMIT 10 OFFSET $Offset") or die(mysql_error());
    while($row = mysql_fetch_array($games))
        {
            $GameID = $row['GameID'];
            $Winner = $row['Winner'];
            $Loser = $row['Loser'];
            $Map = $row['Map'];
            $DateT = $row['DateT'];
            $Year = substr($DateT, 0, 4);
            $Month = substr($DateT, 4, 2);
            $Day = substr($DateT, 6, 2);
            $Hour = substr($DateT, 8, 2);
            $Minute = substr($DateT, 10, 2);
            $Second = substr($DateT, 12, 2);
            $DateT = "$Hour:$Minute:$Second on $Month/$Day/$Year";
            $WOldRank = $row['WOldRank'];
            $WNewRank = $row['WNewRank'];
            $LOldRank = $row['LOldRank'];
            $LNewRank = $row['LNewRank'];
            $WOldRank = $row['WOldRank'];
            $WNewRank = $row['WNewRank'];
            $LOldRank = $row['LOldRank'];
            $LNewRank = $row['LNewRank'];
            $LRank = Rank($LOldRank,$LNewRank);
            $WRank = Rank($WOldRank,$WNewRank);    
            echo "<li><a href=\"http://".$_SERVER[SERVER_NAME]."/player.php/php?player=$Winner\">$Winner</a> ($WRank) defeated <a href=\"http://".$_SERVER[SERVER_NAME]."/player.php/php?player=$Loser\">$Loser</a> ($LRank) on \"$Map\" at <a href=\"http://server.war2.ru/reports/$GameID\" target=\"_blank\">$DateT</a>.</li>\n";
        }
?>
</ul></h4></div></div><div id=\"FooterLinks\" class=\"FooterLinks\">
<?php
    TablePages($Offset,$Player1,$Player2,$result);
?>
<h5 style="text: x-small; font-weight: normal;">All Times are in MSK (UTC +3).</h5></div>
<?php
     function TablePages($Offset,$Player1,$Player2,$result)
    {
        $count = mysql_num_rows($result);
        if($count > 10)
            {
                if($Offset == 0)
                    {
                        $Offset = 10;
                        $LinkString = "<a href=\"http://".$_SERVER[SERVER_NAME]."/record.php/php?offset=$Offset&player1=$Player1&player2=$Player2\">Next Page >></a>";
                    }
                else
                    {
                        if($count > $Offset + 10)
                            {
                                $NextPage = $Offset + 10;
                                $PrevPage = $Offset - 10;
                                $LinkString = "<a href=\"http://".$_SERVER[SERVER_NAME]."/record.php/php?offset=$PrevPage&player1=$Player1&player2=$Player2\"><< Previous Page</a><span style=\"color:#005DB3\">  | </span><a href=\"http://".$_SERVER[SERVER_NAME]."/record.php/php?offset=$NextPage&player1=$Player1&player2=$Player2\">Next Page >></a>";
                            }
                        else
                            {
                                $PrevPage = $Offset - 10;
                                $LinkString = "<a href=\"http://".$_SERVER[SERVER_NAME]."/record.php/php?offset=$PrevePage&player1=$Player1&player2=$Player2\"><< Previous Page</a>";
                            }
                    }
            }
        echo $LinkString;
    }
?>
</div>
</body>
</html>
Code:
ul { 
    text-align: left;
    list-style-type: none;
    margin-top = .5em;
}
li {
    padding: 2px;
}
.GamesWrapper {
    text-align: center;
    position: relative;
    border: thin #CCC solid;
    padding: 5px;
    width: 95%;
    margin-right: auto;
    margin-left: auto;
    margin-bottom: 15px;
}
.Games{
    height: 295px;
}
table{
    position: relative;
    text-align: center;
    color: #02243C;
    background-color: #F9F9F9;
    border: thin #02243C solid;
    width: 75%;
    margin-left: auto;
    margin-right: auto;
    border-collapse: collapse;
}
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
For reference, attached are screenshots of MSIE 6/Win2k & 8/XP (generated by browsershots) and Safari 4 illustrating the behavior.

The document isn't valid HTML 4, transitional or strict. In particular, there's:
  • an unclosed <h3>
  • a <ul> as a child of a <h4> (headings can only have inline elements as children)
  • the double quotes around the values for the attributes of #FooterLinks are escaped
<h?> are header elements, and should only be used for headings. That might be throwing IE off.

Edit: the unclosed <h3> is the culprit. You should also remove the <h4> around the <ul>. Just goes to show the value of validation.
 

Attachments

  • msie-6.0-windows-2k.png
    msie-6.0-windows-2k.png
    23.7 KB · Views: 25
  • msie-8.0-windows-xp.png
    msie-8.0-windows-xp.png
    53.9 KB · Views: 24
  • safari-4-mac-tiger.png
    safari-4-mac-tiger.png
    52.1 KB · Views: 22
Last edited:

garrensilverwing

New Member
Messages
148
Reaction score
0
Points
0
ah ok, i wasnt sure how to go about validating a php document but i guess i could have just got the source from the output and validated that! thanks a lot misson! problem solved, also i removed the <h4> parent thing...
 
Top