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

КОМЕНТАРІ • 20

  • @ByteGrad
    @ByteGrad  Рік тому +1

    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

  • @lrw.z
    @lrw.z 5 місяців тому +1

    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. ❤

  • @sakthivelnagendran3068
    @sakthivelnagendran3068 Рік тому +7

    Hi, how to change the default blue background color

    • @FaisalAnsari-ch4pl
      @FaisalAnsari-ch4pl Рік тому +1

      Did you get the answer

    • @alambis
      @alambis Рік тому

      How to cahnge that.😢

    • @niiiseniisenise
      @niiiseniisenise 4 місяці тому +1

      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.

    • @timoosterveer4087
      @timoosterveer4087 2 місяці тому

      @@niiiseniisenise Thankyou, very much!

  • @jaiprakashrai969
    @jaiprakashrai969 4 місяці тому

    @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.

  • @Fred3dDigitalPainting
    @Fred3dDigitalPainting 4 місяці тому

    Hi !
    Your code works on Chrome. On Firefox the color of the selected element disappears.

  • @desteryezithcaballero6874
    @desteryezithcaballero6874 Рік тому

    ty for the video bro

  • @gabrielpereyra6759
    @gabrielpereyra6759 5 місяців тому +1

    This was pretty helpful, but now I'm wondering how we can change the default blue highlight to another color.

    • @niiiseniisenise
      @niiiseniisenise 4 місяці тому +1

      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.

    • @gabrielpereyra6759
      @gabrielpereyra6759 4 місяці тому +1

      @@niiiseniisenise ill have to try that! Thanks for the info 😊

    • @gabrielpereyra6759
      @gabrielpereyra6759 4 місяці тому

      @@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

    • @niiiseniisenise
      @niiiseniisenise 3 місяці тому

      @@gabrielpereyra6759 do you have a git repo? maybe i can help

  • @niharikasaitana5793
    @niharikasaitana5793 Рік тому

    how to set dynamically for all the option tag inside the select

  • @v2al389
    @v2al389 10 місяців тому

    what is our selector has a id? where would the id go inside the css?

  • @talhaanwar7265
    @talhaanwar7265 Рік тому +1

    Thanks bro 😊

  • @ghazanferwahab5673
    @ghazanferwahab5673 Рік тому +1

    did not work for me bro can u tell why:
    option:hover {
    background: aqua !important;
    }