Designing a custom style for a select box using CSS and HTML

Recently, someone assisted me in removing the outline of my select box in my debut bootstrap-django project. Now, I am seeking your guidance on altering the border color property of the options box itself from blue to yellow. Strangely, when the select box defaults to its initial value, the border appears yellow, but upon selecting an option, it darkens. My goal is to have the border remain a darker shade from the outset.

Below is the CSS in question:

.selector{
    outline:none;
    position:absolute;
    border-radius:1rem;
    margin-left:260px;
    width:500px;
    border-color: #C9C9C9;
    height:35px;
    font-size: 15px;
    text-align-last: center;
    color:#C9C9C9;
}

.selector:focus{
    border-color:#FFD700;
    box-shadow: 0 0 8px #FFD700;
}

Accompanying HTML code:

<div class="div1">
  <label for="estado" class="label1">
    Estado
    <select class="selector" id="estado" name="estado" onchange="functionfs()" style="border-color: #C9C9C9; ">
      <option style="color:black" selected="selected" value="-----">--- Ingrese un valor ---</option>
      <option value="Activo" style="color:black;">Activo</option>
      <option value="Inactivo" style="color:black;">Inactivo</option>
    </select>
  </label>
</div>

JavaScript snippet for reference:

<script type="text/javascript">
  var selector = document.getElementById("estado");
  function functionfs(valor) {
    selector.setAttribute("style", "color:black;");
  }
</script>

I have included two images illustrating the issue:

https://i.sstatic.net/OmFwt.png

https://i.sstatic.net/GIsez.png

If you examine the screenshots, you'll notice that selecting a state and clicking on it again causes it to darken. Your assistance is greatly appreciated!

Thank you all for your help!

Answer №1

Below is the resolution for your dimmer and shining issue:

CSS code for selecting a class

.selector {
    outline: none;
    position: absolute;
    border-radius: 1rem;
    margin-left: 260px;
    width: 500px;
    height: 35px;
    font-size: 15px;
    text-align-last: center;
    color: #000000;
    border-color: #FFD700 !important;
    box-shadow: 0 0 8px #FFD700;
}

The blue border cannot be modified as it is determined by the operating system

Click here to view an example

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Should we pass <script> tags or unsanitized values to the Handlebars layout?

How can I pass values to handlebars that are not sanitized upon output? For instance, I want to ensure that when using the code res.render('index', {script: '<script src="bundle.js"></script>'}), it is not rendered as {{scri ...

Toggle the visibility of div elements by clicking on another div

Hey everyone, I have this cool concept where clicking on different flags will reveal a corresponding list. However, my jQuery code doesn't seem to be functioning properly. $('.canadaflag').click( function() { $(".canadalocations").toggl ...

Disabling pagination for custom searches in datatables

I need to implement a search filter based on only 2 columns using text fields. So, I have set up two text fields: <input type="text" id="type" name="type" placeholder="Filter by User Type"></td> <input type="text" id="dept" name="dept" pla ...

Javascript's asynchronous initiator

Starting a variable synchronously has been a common practice. const x = call_a_sync_function(); However, issues arise when the initiator switches to async. const x = await call_an_async_function(); // SyntaxError: Unexpected reserved word I experimente ...

What is the best way to toggle the display using Jquery?

I'm in the process of setting up a FAQ page where answers can be toggled for display. Here is the step-by-step guide on how to achieve it: $(document).ready(function () { $('.faqlink').click(function () { $('.hiddenFAQ&ap ...

Efficiently perform complex nested grouping using the powerful array

Hi, I'm currently facing difficulties while attempting to utilize the array.reduce() function in order to achieve correct grouping for a specific scenario: Here is my original array: { { descriptionFunction: "Change", processDate: "201 ...

Database verification failed to trigger modal display

I am currently in the process of developing a registration form that has a specific condition - if a person is already registered, they should not be able to register again. My Request Below is the PHP MySQL query that I am using to check for existing en ...

Preserving the most recent choice made in a dropdown menu

Just started with angular and facing an issue saving the select option tag - the language is saved successfully, but the select option always displays English by default even if I select Arabic. The page refreshes and goes back to English. Any assistance o ...

Combining multiple JSON strings into a single object using JavaScript

I am facing an issue with parsing a JSON output that contains two strings with specific formats: [{"device_id":"9700015","update_time":"2017-01-04 18:30:00","sensor_value":"1287.6"}] [{"device_id":"9700016","update_time":"2016-12-31 18:30:00","senso ...

Are there any more efficient methods to retrieve an object from an arrow function in TypeScript?

Trying to retrieve an object from an arrow function is posing a challenge for me, especially with the following function f: myMethod(f: data => { return { someField: data.something }; }); I am aware that for simple types, you can condense the arrow ...

Design a sophisticated background using CSS

https://i.sstatic.net/yILwL.png I am wondering if there is a way to create a CSS3 background similar to the one shown in the image link above. The gradient should smoothly transition from white to black, spanning across a header div, and remain consistent ...

Find the highest value in a MySQL column

Currently, I am working with a mysql table in NodeJs where there is a column called packageId. My goal is to fetch the highest value from that particular column. For instance, if the values in the column are 2,3,4,5, I only want to retrieve 5. I attempted ...

What is the ideal framerate for smooth animation?

I'm looking to add a snow animation using JavaScript. I currently have it running at 200ms which is decent but not smooth enough. Would changing the interval to 20ms make it more fluid, or would it be inefficient and strain the CPU? window.setInterva ...

Encountered an issue during the creation of a Nuxt.js project using the command line tool, where a SyntaxError was triggered

I encountered an issue while attempting to set up a nuxt.js starter project using the nuxt cli. Here are the steps I followed: Installed vue cli globally with the command: npm install -g vue-cli Created the project using: vue init nuxt-community/star ...

Creating a JSON array in JavaScript for future reference

I am interested in creating a JSON array where I can define the fields and add data to it later in my code. However, I am unsure about the correct syntax to achieve this. So far, my attempts have resulted in some parse errors; <script> var myJSONAr ...

`The functionality of parent.location is not operating as expected in Firefox and Chrome, however, it is functioning

Issue with JSP: <A NAME="CustomerInformation"></A> <table class="SectionHeader1"> <TBODY>enter code here <tr> <td>Customer Information</td> </tr> </TBODY> </table ...

utilizing BrowserRouter for dynamic routing in react-router-dom

I'm currently facing a challenge with creating a multi-tenant SaaS solution. Each tenant needs to be able to use a subdomain, so that I can extract the subdomain from the URL and make a call to a REST API to retrieve data specific to that tenant. For ...

Trigger oncopy on the body excluding specific class

Is there a way to execute a function on document.body.oncopy but exclude a certain class (defined for div elements) from this function call? I want to avoid calling the function on specific classes, is there a method to achieve this? ...

Is there a way in Bower to automatically select only CSS or JS files from an open source project, rather than both, if that is my preference?

Although I suspect the answer, imagine I desire to incorporate the CSS from Twitter Bootstrap without the Javascript. I've set up a gulp script to extract everything from my bower.json file, minimize the JS, compress the CSS, and transfer it to my de ...

Convert JQuery to a click event

I have a code snippet that is currently functioning properly $(window).load(function(){ $(document).ready(function(){ $("input[name ='_sft_product_cat[]']").parent().next(".children").css("background", "yellow"); }) }); My goal is to convert th ...