Reply to Re: CSS color conditional on content

Your name:

Reply:


Posted by Jukka K. Korpela on 11/23/07 09:12

Scripsit Summercool:

> for CSS, is it possible to say, if the content in the div or span is
> 0, show the "0" in red, and if it is a "1", show it in green?

Of course not. Read a primer on CSS to get an idea of what CSS is about,
and you won't ask questions like that.

> I can
> use PHP or any script to do it, but it probably is quite handy to let
> CSS handle the formatting style without needing server support.

There's nothing handy about it: it's not possible, and it's not
something that CSS is meant for.

You can use a class attribute to distinguish, say, the elements you
would like to appear in red from those you'd like to be green. However,
you should bear in mind that about 10% of male population are unable to
distinguish red from green well (or at all), so even as auxiliary method
(to highlight a difference that already exists in content, like "0" from
"1"), it's not a good choice.

We heard you the first time, and you crossposted pointlessly, since
c.i.w.a.h. is strictly about HTML, not CSS (and not about server-side
technologies either). Followups trimmed.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация