CSS

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentCSS

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old June 3rd, 2013, 04:09 PM
cjackson111 cjackson111 is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 9 cjackson111 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 52 m 36 sec
Reputation Power: 0
Problem with CSS and radio buttons

I have a problem with adding colors to my set of radio buttons. I am developing a quiz app (using HTML5, CSS, JavaScript). I have 2 classes setup for when a correct and incorrect radio button is clicked on.

The following is my CSS code...

Code:
.correct{
        background-color:#090;
        color:white;
    }
.wrong{
        background-color:#f00;
        color:white;
    }




When the 'correct' radio button is clicked on it turns bold green with a white dot in the center (as it should). Same goes for an incorrect answer...turns to red.

My problem is that even before anything is clicked on the radio buttons are a paler shade of green or red.

Screenshot


How can I set it so the unselected color shows the normal default color? or white? or gray? The following is my html code for the radio buttons...

Code:
$('#page2 article').html('<p><div id="pop"><div class="question"><strong>' + row.question + '</strong>
<br><br>
<input class="' + row.answera + '" type="radio" name="quest' + row.id + '" value="a"/><label> ' + row.A + '</label>
<br><br>
<input class="' + row.answerb + '" type="radio" name="quest' + row.id + '" value="b"/><label> ' + row.B + '</label>
<br><br>
<input class="' + row.answerc + '" type="radio" name="quest' + row.id + '" value="c"/><label> ' + row.C + '</label>
<br><br>
<input class="' + row.answerd + '" type="radio" name="quest' + row.id + '" value="d"/><label> ' + row.D + '</label><br><br></div></div></p>' );



I really appreciate any help that can be thrown my way!

Last edited by cjackson111 : June 3rd, 2013 at 07:39 PM.

Reply With Quote
  #2  
Old June 3rd, 2013, 07:41 PM
cjackson111 cjackson111 is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 9 cjackson111 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 52 m 36 sec
Reputation Power: 0
Found the solution...right under my nose. Just had to add ":checked" after class name.

Code:
.correct:checked{
        background-color:#090;
        color:white;
    }
.wrong:checked{
        background-color:#f00;
        color:white;
    }

Reply With Quote
  #3  
Old December 7th, 2016, 12:04 AM
dishagandhi dishagandhi is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Dec 2016
Location: Ahmedabad
Posts: 52 dishagandhi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 40 m 42 sec
Reputation Power: 1
Simply add checked before class name. using checked, unselected color shows the normal default color.
Example :
Code:
		.correct : checked
		{
			background-color:#090;
			color:white;
		}

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentCSS > Problem with CSS and radio buttons


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap