Change Select List Option Background-Color on Hover in CSS
Вставка
- Опубліковано 18 вер 2024
- 👉 NEW React & Next.js Course: bytegrad.com/c...
Hi, I'm Wesley. I'm a brand ambassador for Kinde (paid sponsorship). I'll help you master the latest tech here:
👉 NEW React & Next.js Course: bytegrad.com/c...
👉 Professional JavaScript Course: bytegrad.com/c...
👉 Professional CSS Course: bytegrad.com/c...
👉 Discord: all my courses have a private Discord where I actively participate
🔔 Email newsletter (BIG update soon): email.bytegrad...
0:00 Solution
#webdevelopment #coding #programming
Hi, mastering JavaScript is critical if you want to be a modern, professional developer: www.udemy.com/course/professional-javascript-course/?referralCode=0C1D5752923168BC87C2
Also, if you are a front-end developer then mastering CSS (including Flexbox, CSS Grid, etc.) is equally important: www.udemy.com/course/professional-css/?referralCode=4C3C08E82629E6B15752
Thanks mate, I also discovered that you can also add a "Option:checked" element to change the color of the selected option insted of the blue line, also I've been facing a problem with select the moment i scroll down it selects automatically to fix that just keep the "onfocus and onblur", remove anything else,
Edit, For the "Option:checked" the background color has to be a "linear-gradient" to work, you can set the same color twice if you don't want a gradient. ❤
Hi, how to change the default blue background color
Did you get the answer
How to cahnge that.😢
For the "option:checked" the background color has to be a "linear-gradient" to work, you can set the same color twice if you don't want a gradient.
@@niiiseniisenise Thankyou, very much!
@ByteGrad -A keyboard user is not able to select the options of this example because of the presence of additional onfocus, onblur, and onchange . Please consider accessibility in your courses.
Hi !
Your code works on Chrome. On Firefox the color of the selected element disappears.
ty for the video bro
This was pretty helpful, but now I'm wondering how we can change the default blue highlight to another color.
This was my problem too!! I fixed it finally with:
option:checked {
background: linear-gradient(to right, green, green);
}
For the "option:checked" the background color has to be a "linear-gradient" to work, you can set the same color twice if you don't want a gradient.
@@niiiseniisenise ill have to try that! Thanks for the info 😊
@@niiiseniisenise I couldn't get it to work haha. When I revisited Google about it, I kept finding work arounds like using custom radio buttons to mimic select/option elements, or to use java
@@gabrielpereyra6759 do you have a git repo? maybe i can help
how to set dynamically for all the option tag inside the select
javascript? or use child selector
what is our selector has a id? where would the id go inside the css?
Thanks bro 😊
did not work for me bro can u tell why:
option:hover {
background: aqua !important;
}