正确打印网站


I am trying to make a website that reads from a csv file and render the data on the screen in a printable format (it is for printing tickets). The page creates 2 tickets per row and loops threw until it runs out of data. It all works perfectly and looks just the way i want it but, when i print it the 3rd row down has one of the rows of text move up onto the line above it.

My question is how can i make it print the way it is seen on the screen and why would it screw up only the 3rd row when all rows are made with the same code.

Thanks EDIT:

while (!feof($file_handle)){`
$csvText = fgetcsv($file_handle, 1024);
    $username = $csvText[1];
    $password = $csvText[2];
    $profile = $csvText[3];
    $daysValid = $csvText[4];
    $expiry = $csvText[5];

if($pos == 0)
{
if($count == 5){
echo "<p><br /></p>";

$count = 0;
}else{
$count++;
}
echo "<div class='itemRow'>";
echo "<div class='left'>";
$pos = 1;
?>
<h4 class="centre">Internet Access Voucher</h4>
<img class="image" src="./icon.jpg" />
<div class="info">
<table>
    <tr>
        <td>
            Username
        </td>
    </tr>
    <tr>
        <td>
            Password
        </td>
    </tr>
    <tr>
        <td>
            Profile
        </td>
    </tr>
    <tr>
        <td>
            Valid for
        </td>
    </tr>
    <tr>
        <td>
            Expiry date
        </td>
    </tr>
</table>
</div>
<div class="uniqueInfo">
<table>
    <tr>
        <td>
            <?php echo $username;?>
        </td>
    </tr>
    <tr>
        <td>
            <?php echo $password;?>
        </td>
    </tr>
    <tr>
        <td>
            <?php echo $profile;?>
        </td>
    </tr>
    <tr>
        <td>
            <?php echo $daysValid;?>
        </td>
    </tr>
    <tr>
        <td>
            <?php echo $expiry;?>
        </td>
    </tr>
</table>
</div>
<p class="centre"><br />Please remember to disconnect to stop each session.</p>
</div>
<br />

<?php
} else {
?>
<div class="right">
<h4 class="centre">Internet Access Voucher</h4>
<img class="imageRight" src="./icon.jpg" />
<div class="infoRight">
<table>
    <tr>
        <td>
            Username
        </td>
    </tr>
    <tr>
        <td>
            Password
        </td>
    </tr>
    <tr>
        <td>
            Profile
        </td>
    </tr>
    <tr>
        <td>
            Valid for
        </td>
    </tr>
    <tr>
        <td>
            Expiry date
        </td>
    </tr>
</table>
</div>
<div class="uniqueInfoRight">
<table>
    <tr>
        <td>
            <?php echo $username;?>
        </td>
    </tr>
    <tr>
        <td>
            <?php echo $password;?>
        </td>
    </tr>
    <tr>
        <td>
            <?php echo $profile;?>
        </td>
    </tr>
    <tr>
        <td>
            <?php echo $daysValid;?>
        </td>
    </tr>
    <tr>
        <td>
            <?php echo $expiry;?>
        </td>
    </tr>
</table>
</div>
<p class="centre"><br />Please remember to disconnect to stop each session.</p>
</div>

</div>

<?php
$pos = 0; 
}
}
?>

CSS

.centre
{
text-align:center;
}

.itemRow
{
position:relative;
top:0px;
}

.left
{
width:500px;
position:relative;
font-family:Comic Sans, Comic sans MS, cursive;
/*border-style:solid;
border-width:1px;*/
}

.right
{
width:500px;
position:absolute;
left:600px;
top:-20px;
font-family:Comic Sans, Comic sans MS, cursive;
/*(border-style:solid;
border-width:1px;*/
}

.image
{
position:absolute;
top:70px;
}

.info
{
position:relative;
left:63px;
}

.uniqueInfo
{
position:absolute;
left:250px;
top:42px;
}

.infoRight
{
position:relative;
left:63px;
top:0px;
}

.uniqueInfoRight
{
position:absolute;
left:250px;
top:65px;
}

.imageRight
{
position:absolute;
top:90px;
}

I suspect this might be the problem:

if($count == 5){
    echo "<p><br /></p>";

You have 2 per row, and increment $count after every ticket. So, $count = 5 would be after the fourth ticket, or when the third row starts. A sample HTML page would give me a better idea of what's going on exactly, but I'd suggest doing something like

<br style="clear: both;" />

between the rows to split them cleanly. So before ticket 3 and 5 ($count = 3 and $count = 5).