Help setting color on text in form group

Good Afternoon,
I am new to this forum and glad to find it. I am writing an app. Using PHP with MYSQL db. On my form (using bootstrap) I am trying to set the color of the text displayed in the select box.

  <div class="col-xs-3">
    <div class="form-group">
        <select class="form-control" name="person-cat">
          <option value=""><span style="color: #FF00FF">Select People Category</span></option>
        <?php  foreach ($all_categories as $cat): ?>
          <option value="<?php echo (int)$cat['id'] ?>">
            <?php echo $cat['name'] ?></option>
        <?php endforeach; ?>
        </select>
  </div>
  </div>

I am trying the <span style in the option value line. Not sure if this is allowed. I would like the text to be red indicating that a select is required.
Thanks in advance.
Rod

One of a few ways. This may not be the way you want to do it though. Best to use CSS and add a class name.

<div class="col-xs-3"> <div class="form-group"> <select class="form-control" name="person-cat" style="color: red;"> <option style="color: purple;" value="">Select Stuff</option> <option style="color: blue;" value="">Text</option> <option style="color: green;" value="">Text Two</option> <option style="color: orange;" value="">Text Two</option> </select> </div> </div>

I would do something more like this:

[php]* Required Field[/php]

This might help:
https://jsfiddle.net/Strider64/Lpwn6vta/

<select id="cats" name="person-cat"> <option value="">Select Cat</option> <option value="">Persian</option> <option value="">Siamese</option> <option value="">Bengal</option> </select>

select { color:red; border:none; outline:none; cursor:pointer; }

I was goofing around a little with the html and css styling some more: https://jsfiddle.net/Strider64/vvs5eeja/

Sponsor our Newsletter | Privacy Policy | Terms of Service