Avatar of breeze351
breeze351

asked on 

Text color in a select

I've changed the background in the select from the default blue to a light gray.  How do I change the text to black?

This if from the css:
select.list1
{
    background-color: #D3D3D3;
}

Open in new window

CSS

Avatar of undefined
Last Comment
Julian Hansen
Avatar of Mukesh Yadav
Mukesh Yadav
Flag of India image

Try this ;)

select.list1{
    background-color: #D3D3D3;
}

select.list1 option{
    color: #000; /* For text color */
}

Open in new window

Avatar of breeze351
breeze351

ASKER

How do I change the color?
Heres the code
			<select class = "list1" name = "Up_North">
			<?php
				//Iterate through Street File and populate drop down
				$SqlString1 = "SELECT * FROM street_grid order by STREET desc";
				$Street_Data = $conn->query($SqlString1);
				while ($ROW = $Street_Data->fetch_array())
				{
					echo "<option value = \"";
					echo $ROW['STREET'];

Open in new window

Avatar of Mukesh Yadav
Mukesh Yadav
Flag of India image

Just add these css rules:

select.list1{
    background-color: #D3D3D3;
}

select.list1 option{
    color: #000; /* For text color */
}

Open in new window

Avatar of breeze351
breeze351

ASKER

Okay, I'm an idiot!
The code in the page is:
			<select class = "list1" name = "Up_North">
			<?php
				//Iterate through Street File and populate drop down
				$SqlString1 = "SELECT * FROM street_grid order by STREET desc";
				$Street_Data = $conn->query($SqlString1);
				while ($ROW = $Street_Data->fetch_array())
				{
					echo "<option value = \"";
					echo $ROW['STREET'];

Open in new window


The css reads as follows:
select.list1
{
    background-color: #D3D3D3;
}
select.list1 option{
    color: #000;
}

Open in new window


Am I missing something on the line in this code:
echo "<option value = \"";
					echo $ROW['STREET'];
					echo "\"";

Open in new window

Avatar of Mukesh Yadav
Mukesh Yadav
Flag of India image

Share whole while loop code part.
Avatar of breeze351
breeze351

ASKER

You want it. You got it,  Here's all the code in question:
<!-- North -->
		<td>
			<div id="Body_Labels">
				<p style="margin-bottom: 0px;">North:</p>
			</div>
		</td>  
        
		<td>
			<select class = "list1" name = "Up_North">
			<?php
				//Iterate through Street File and populate drop down
				$SqlString1 = "SELECT * FROM street_grid order by STREET desc";
				$Street_Data = $conn->query($SqlString1);
				while ($ROW = $Street_Data->fetch_array())
				{
					echo "<option value = \"";
					echo $ROW['STREET'];
					echo "\"";
					if ($ROW['STREET'] == $Up_North)
				 	{
						echo " selected";
					}
					echo ">";						
					echo $ROW['STREET'];
					echo "</option>";
				}
			?>
			</select>
		</td>
		<!-- End North -->      

Open in new window


Thanks
Avatar of Mukesh Yadav
Mukesh Yadav
Flag of India image

Everything is fine.
Avatar of breeze351
breeze351

ASKER

It might be fine but it doesn't work!
User generated image
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of breeze351
breeze351

ASKER

Thanks
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

You are welcome.
CSS
CSS

Cascading Style Sheets (CSS) is a language used for describing the look and formatting of a document written in a markup language. Usually used to change web pages and user interfaces written in HTML, it can also be applied to any kind of XML document. CSS is designed primarily to distinguish the content of a document from its presentation.

43K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo