100% width table row half way down a table

The index page on my site shows the most recent submissions from my users. It uses a HTML table as markup, and is generated using PHP. The tr markup looks like this:

<tr>
    <td class="preview"><img alt="Minecraft skin preview" src="link"></td>
    <td class="skin">
        <span class="title"><a href="link">Skin Edit preview broken but I did my best</a></span><br />
        <span class="desc">Seraphinite Hunter</span>
    </td>
    <td class="auth">MikeSilver</td>
    <td class="time">23-5-2011</td>
    <td class="links">
        <a target="_blank" href="link">Download</a><br>
        <a target="_blank" href="link">Remote</a>
    </td>
</tr>

What I want is to have an AdSense ad displayed approx half way down the table. To do this, I halved the number of tr elements and rounded the number down, and then I'm using a counter in my PHP code to detect where to put in my AdSense code. Thing is, when I do this, the table breaks.

I was doing something like this:

<?php $limit = floor($site['skinsPerPage'] / 2); $counter = 0; ?>
<?php foreach($skins as $skin): ?>
    <?php if($counter == $limit): ?>
        <tr>
            <td>
                <!-- adsense code -->
            </td>
        </tr>
    <?php else: ?>
        <!-- normal table code (as above) -->
    <?php endif; ?>
    <?php $counter++; ?>
<?php endforeach; ?>

Does anyone know the proper styling I can use to display this AdSense ad in a table cell centered in the middle of my table? It seems to break the table whatever I do, and push all the other td elements of the table off to one side.

Thanks!

Answers


Turn your <td> into <td colspan="6"> (or however many columns your table has).

You are essentially shoving a huge, wide element into the first column of the table. Using colspan allows the table cell to use more than one column.


Need Your Help

Application start on logon with Java

java windows startup

So my question today is one of personal academic willingness to learn, despite it probably being a little beyond my level. Bear with me on this!

Syntax parameter in $.ajax and first load page

javascript jquery html ajax

I would like display my data following a tag select.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.