简体   繁体   中英

Footnote in HTML Table

In the following HTML table snippet, I will like to add footnotes (or simple comments) for columns "stat 1", "stat 2" and "stat 3" to explain each of the stats in more detail. Preferably, want the comments/details to appear right below the table with each comment correctly referring to the right column. Any suggestion on how to achieve this? Thanks.

    if(!empty($output))
    {

        echo '<table cellpadding="0" cellspacing="0" class="imagetable">';
        echo '<caption>Table 1</caption>';
        echo '<tr><th>Date</th><th>Stat 1</th><th>Stat 2</th><th>Stat 3</th><th></tr>';

        foreach ($output as $result)
        {
            $temp = explode(" ",$result);
            echo '<tr>';
            for($i=0;$i<count($temp);$i++){
                echo '<td>',$temp[$i],'</td>';
            }
            echo '</tr>';
        }
        echo '</table><br />';
    }

You could use tfoot ( http://www.w3schools.com/tags/tag_tfoot.asp )

if(!empty($output))
    {

        echo '<table cellpadding="0" cellspacing="0" class="imagetable">';
        echo '<caption>Table 1</caption>';
        echo '<thead><tr><th>Date</th><th>Stat 1</th><th>Stat 2</th><th>Stat 3</th></tr></thead>';
        echo '<tfoot><tr><td>&nbsp;</td><td>*note 1</td><td>*note 2</td><td>*note 3</td></tr></tfoot>';

        foreach ($output as $result)
        {
            $temp = explode(" ",$result);
            echo '<tr>';
            for($i=0;$i<count($temp);$i++){
                echo '<td>',$temp[$i],'</td>';
            }
            echo '</tr>';
        }
        echo '</table><br />';
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM