Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Styling Negative Numbers

New Here ,
Jun 04, 2010 Jun 04, 2010

I have a Coldfusion query that is populating an HTML table.  I would like to style the negative numbers with a Font color of Red and any non negative numbers with a Font color of Black.  Any ideas on how to accomplish this.

602
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 04, 2010 Jun 04, 2010

You could use an if statement that checks if the value is less than 0,

set the font to red, if 0 or greater, set the font to black.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 06, 2010 Jun 06, 2010
LATEST

I'd do what Debbie suggested  Something like:

<span class="#iif(num lt 0,DE("red"),DE("black"))#"> </span>

Then in your stylesheet:

.red { color: red; }

.black { color: black; }

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources