The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Use CSS to perform a boolean test on an element's content?
Christopher Tidy
post Apr 3 2009, 01:42 PM
Post #1


Newbie
*

Group: Members
Posts: 15
Joined: 3-May 07
Member No.: 2,708



Hi folks,

Suppose I have the following code:

<SPAN>1.2</SPAN>

Is there any way I can colour the text depending on the first digit of the number which appears in the SPAN? So that for example a number greater than or equal to 1 but less than 2 is red, and a number greater than or equal to 2 but less than 3 is orange? I know I can do it by giving the SPAN a class according to its content, but I was wondering if there's a neater way.

I can't find a reference to any such a method online, but feel that perhaps there should be one given the way that CSS can be used to detect an external link using the "http:", etc.

Any suggestions would be much appreciated.

Many thanks,

Chris Tidy
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 20th April 2024 - 04:24 AM