0

In the CSS of my HTML table I would like to insert conditional formatting code for the td-elements. If the value of such an element's content is lower than 500, I want that value to be displayed in red. If not, it should be in black.

So if in my table there is e.g. the code <td>439</td>, that number should be displayed in red. If it's <td>578</td>, it should be in black.

This is the CSS code I think would work (using the SCSS extension):

td {
    @if xxxxx < 500 {
        color: red
    } else {
        color: black
    }
}

What should I put instead of xxxxxx? Or perhaps you know of an alternative coding solution.

Red Knight
  • 77
  • 7
  • Does this answer your question? [Is there a CSS selector for elements containing certain text?](https://stackoverflow.com/questions/1520429/is-there-a-css-selector-for-elements-containing-certain-text) – Cédric Sep 26 '22 at 13:46
  • No. The question is for formatting based purely on the value of the inner element, not that of an attribute. – Red Knight Sep 26 '22 at 17:13

0 Answers0