0
CSS Table Negative on Red
Mirko
Hi Mirko, there are any way to place the Negative Number on Red Color.
I use the following code.
let content := "
<style>
table{
width:100%;
}
.tableFixHead {
overflow-y: auto;
height: 345px;
}
th {
padding: .3em .5em .2em .5em;
border-radius: .3em .3em .3em .3em;
font-size:medium;
}
td{
font-size:small;
background-color: rgb(133,148,194,.3);
padding: .1em .5em .1em .5em;
border-radius: .3em .3em .3em .3em;
}
thead,tfoot{
background-color:rgb(133,148,194);
position: sticky;
font-size:small;
}
thead {
top: -.3em;
text-align:center;
}
tfoot{
bottom: -.3em;
}
tr:nth-child(odd) td{
background-color: rgb(240,240,240);
}
td:nth-child(3), td:nth-child(4){text-align:center; } td:nth-child(5),td:nth-child(6),td:nth-child(7),td:nth-child(8){
text-align:center;
}
</style>
<div class='tableFixHead'>
<table>
<thead>
<tr>
<th> Documento </th>
<th> P1 </th>
<th> P2 </th>
<th> P3 </th>
<th> P4 </th>
<th> P5 </th>
</tr>
</thead>
<tbody>
" + ((select Deliverables) order by Week).("
<tr>
<td> " + Document + " </td><td> " + P1 + " </td><td> " + P2 + " </td><td> " + P3 + " </td><td> " + P4 + " </td><td> " + P5 + " </td>
</tr>
") + "
</tbody>
<tfoot>
<tr>
<th style = text-align:center># " + cnt((select Deliverables)[DataDate]) + "</th>
<th style = text-align:center scope='colgroup' colspan='5' > Negative value, days to be issued </sub> " + "</th>
</tr>
</tfoot>
</table>
</div>
";
html(content)
3 Antworten
-
For example for P1. If the type or P1 is number, you need not the function number(). Mirko
<td style=background-color:" + if number(P1) < 0 then "red" end + "> " + P1 + " </td>
-
Mirko Thanks Mirko as usual excelent.
Thanks
Content aside
- Status Answered
- vor 1 JahrZuletzt aktiv
- 3Antworten
- 130Ansichten
-
2
Folge bereits