JSFiddle - React, Tailwind, and code Playground
HTML
<table cellpadding="0" cellspacing="0" class="tablesorter">
<h2>Ratings</h2>
<thead><th>Questions</th><th>Average</th></thead>
<cfif #result2Sum.averageSum# gt 0>
<cfloop query="result2test">
<tbody>
<tr> <td nowrap="nowrap">test.............................................</td> <td>test <cfif q1 gt 0><cfset counter+=1><cfset total+=q1></cfif></td> </tr>
<tr> <td nowrap="nowrap">test.....................................................................................................................................................................................................................</td> <td>test <cfif q2 gt 0><cfset counter+=1><cfset total+=q2></cfif></td></tr>
<tr> <td nowrap="nowrap">test.............................................</td> <td>test <cfif q3 gt 0><cfset counter+=1><cfset total+=q3></cfif></td></tr>
<tr> <td nowrap="nowrap">test.............................................</td> <td>test <cfif q4 gt 0><cfset counter+=1><cfset total+=q4></cfif></td></tr>
<tr> <td nowrap="nowrap">test.............................................</td> <td>test <cfif q5 gt 0><cfset counter+=1><cfset total+=q5></cfif></td></tr>
</tbody>
<tfoot>
<tr>
<th>Average Total</th>
<th><cfif counter gt 0><div id="test">#DecimalFormat(total/counter)#</div> <cfset averagestotal +=total/counter></cfif> </th>
</tr>
</tfoot></cfloop>
<cfelse>
<tr> <td nowrap="nowrap" colspan="2">No results</td> </tr>
</cfif>
</table>
CSS
/* tables */
table.tablesorter {
border: 1px solid #D9D9D9;
}
#test {
word-wrap:break-word;
width:40px;
}
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
background-color: #04659D;
border-bottom: 1px solid #0F5E76;
border-left: 1px solid #0F5E76;
font-weight: bold;
text-align:left;
padding: 5px 19px 5px 9px;
color: #fff;
}
table.tablesorter thead tr .header {
background-image: url(bg.gif);
background-repeat: no-repeat;
background-position: center right;
cursor: pointer;
}
table.tablesorter tbody td {
padding: 5px 9px;
vertical-align: top;
}
table.tablesorter tbody tr.odd td {
background-color:#f7f7f7;
}
table.tablesorter thead tr .headerSortUp {
background-image: url(asc.gif);
}
table.tablesorter thead tr .headerSortDown {
background-image: url(desc.gif);
}
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
background-color: #048EDD;
border-bottom: 1px solid #048EDD;
border-left: 1px solid #048EDD;
}
table.tablesorter.hovcolor {
background-color: #FDFFC7;
color: #000;
}
table.tablesorter.highlight {
background-color: #E5F6FC;
color: #000;
}