 |
| CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS). |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 27th, 2007, 08:03 AM
|
|
Registered User
|
|
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Can i handle this thru CSS
Hi Guys,
Here's food for thought. :)
I have this wonderful project which driving me nuts. (But on the other
hand, its very interesting) There is one problem which is of big
concern. The problem is, how can someone apply 2 separate style to
Select tag.
I.E.
<select>
<option value ="ColorChange ">RED GREEN</option>
</select>
The word RED should be in RED Color and GREEN Should be in GREEN
color. Whatever you do, see to that this is W3C compliant and tested
on FireFox, IE 7 and 6.
Another important thing, please do not use any JavaScript for this.
Its a complete NO NO.
I am trying to crack this, if anyone has done this before then please
let me know.
Cheers
Pravin
regards,
Pravin Parmar
+919820342525
|
|

December 27th, 2007, 06:20 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
It's simple enough. You can't do it. 
OPTION can only contain text so there is no way to mark up the two different words.
--
http://yupapa.com
|
|

January 8th, 2008, 08:40 AM
|
|
Registered User
|
|
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanks for the reply.
fine i can understand that i cannot use markup, but is there any way i can control the styling thru css?
cheers
pravin
Quote:
quote:Originally posted by meow
It's simple enough. You can't do it. 
OPTION can only contain text so there is no way to mark up the two different words.
--
http://yupapa.com
|
regards,
Pravin Parmar
+919820342525
|
|

January 8th, 2008, 10:38 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
You can't apply CSS without any markup to hang it on. How would you select singular words in any kind of text without marking them up?
--
http://yupapa.com
|
|

January 8th, 2008, 07:00 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
Im not a CSS expert. There are plenty of them who are very helpful here at wrox, I always look and learn from thier posts.
Do you have a functional reason for this? Visually, IMO it would be a bit of an eye sore. I remain intrigued at why you would want to do this?
Wind is your friend
Matt
|
|

January 9th, 2008, 06:37 AM
|
|
Registered User
|
|
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
yeah i do have, its a kind of feature that i am thinking of implementing. It goes something like this,
<select>
<option value ="ColorChange ">Members 2,400</option>
<option value ="ColorChange ">Groups 300</option>
</select>
I am thinking of populating the numbers of the members dynamically, but i need to separate these with different color codes.
Hope this explains, why i need it..
Cheers
niv
Quote:
quote:Originally posted by mat41
Im not a CSS expert. There are plenty of them who are very helpful here at wrox, I always look and learn from thier posts.
Do you have a functional reason for this? Visually, IMO it would be a bit of an eye sore. I remain intrigued at why you would want to do this?
Wind is your friend
Matt
|
regards,
Pravin Parmar
+919820342525
|
|

January 9th, 2008, 10:58 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
In that case I misunderstood you. Sorry for that.
To be clear, do you want each OPTION to have a different color? That you can (in the browsers that support it). Just give each option a class. If you want only two colors it's enough to give every second OPTION a class.
Code:
option { color: red; background: yellow }
.blah { color: white; background: black }
Code:
<select>
<option>AAAAA</option>
<option class="blah">AAAAA</option>
<option>AAAAA</option>
<option class="blah">AAAAA</option>
</select>
--
http://yupapa.com
|
|

January 9th, 2008, 06:48 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
I understood the question the same as meow did. The reason i said 'eye sore' is because I believed you asked for two colors in the same option tag (which I think you did - now that would have been, as mentioned above, an eye sore.)
Anyhow pleased you got your solution...
Wind is your friend
Matt
www.elitemarquees.com.au
|
|

January 9th, 2008, 06:57 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Yeah, when I read nivarp's post again now I don't understand how I could misunderstand it, but I was sure that was what he asked about. As you say, sore eyes. And jumping to conclusions maybe.
--
http://yupapa.com
|
|

January 17th, 2008, 03:03 AM
|
|
Registered User
|
|
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey guys,
Thanks for the help.
cheers
niv :)
Quote:
quote:Originally posted by meow
Yeah, when I read nivarp's post again now I don't understand how I could misunderstand it, but I was sure that was what he asked about. As you say, sore eyes. And jumping to conclusions maybe. 
--
http://yupapa.com
|
regards,
Pravin Parmar
+919820342525
|
|
 |