Wrox Programmer Forums
|
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
 
Old December 27th, 2007, 08:03 AM
Registered User
 
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nivarp
Default 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
 
Old December 27th, 2007, 06:20 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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
 
Old January 8th, 2008, 08:40 AM
Registered User
 
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nivarp
Default

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
 
Old January 8th, 2008, 10:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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
 
Old January 8th, 2008, 07:00 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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
 
Old January 9th, 2008, 06:37 AM
Registered User
 
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nivarp
Default

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
 
Old January 9th, 2008, 10:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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
 
Old January 9th, 2008, 06:48 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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
 
Old January 9th, 2008, 06:57 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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
 
Old January 17th, 2008, 03:03 AM
Registered User
 
Join Date: Sep 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nivarp
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS HELP:! CSS EXPANDIBLE BACKGROUND FOR TITLE phpuser2000 CSS Cascading Style Sheets 2 December 19th, 2007 12:36 AM
Rich's new CSS book: Beginning CSS 2nd Edition jminatel BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 0 June 15th, 2007 11:55 AM
How to handle...? chawnu Pro PHP 1 December 8th, 2005 05:14 AM
Getting handle of the file in use baburman .NET Framework 2.0 0 October 16th, 2005 10:56 PM
Getting value contained by HANDLE panja_swarup C++ Programming 1 December 16th, 2003 10:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.