<tfoot id='YbWsJ'></tfoot>
    <legend id='YbWsJ'><style id='YbWsJ'><dir id='YbWsJ'><q id='YbWsJ'></q></dir></style></legend>

    <small id='YbWsJ'></small><noframes id='YbWsJ'>

        <bdo id='YbWsJ'></bdo><ul id='YbWsJ'></ul>
      <i id='YbWsJ'><tr id='YbWsJ'><dt id='YbWsJ'><q id='YbWsJ'><span id='YbWsJ'><b id='YbWsJ'><form id='YbWsJ'><ins id='YbWsJ'></ins><ul id='YbWsJ'></ul><sub id='YbWsJ'></sub></form><legend id='YbWsJ'></legend><bdo id='YbWsJ'><pre id='YbWsJ'><center id='YbWsJ'></center></pre></bdo></b><th id='YbWsJ'></th></span></q></dt></tr></i><div id='YbWsJ'><tfoot id='YbWsJ'></tfoot><dl id='YbWsJ'><fieldset id='YbWsJ'></fieldset></dl></div>

      1. 如何在悬停时更改选择选项的背景颜色

        时间:2023-09-05

          <tbody id='cLdq5'></tbody>

        <small id='cLdq5'></small><noframes id='cLdq5'>

      2. <legend id='cLdq5'><style id='cLdq5'><dir id='cLdq5'><q id='cLdq5'></q></dir></style></legend>
          1. <tfoot id='cLdq5'></tfoot>
              <bdo id='cLdq5'></bdo><ul id='cLdq5'></ul>

                • <i id='cLdq5'><tr id='cLdq5'><dt id='cLdq5'><q id='cLdq5'><span id='cLdq5'><b id='cLdq5'><form id='cLdq5'><ins id='cLdq5'></ins><ul id='cLdq5'></ul><sub id='cLdq5'></sub></form><legend id='cLdq5'></legend><bdo id='cLdq5'><pre id='cLdq5'><center id='cLdq5'></center></pre></bdo></b><th id='cLdq5'></th></span></q></dt></tr></i><div id='cLdq5'><tfoot id='cLdq5'></tfoot><dl id='cLdq5'><fieldset id='cLdq5'></fieldset></dl></div>
                  本文介绍了如何在悬停时更改选择选项的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想更改悬停时选择选项的背景颜色,我尝试了以下规则,但也没有用:

                  I want to change the background color of the select options on hover and i have tried the followed rules but it didn't worked either:

                   select option {
                      color: #fff;
                    }
                    select option:hover {
                      color: #000;
                      box-shadow: inset 20px 20px #fff;
                    }
                  

                  我必须应用哪些规则才能达到这种效果?JS 是否识别选项元素中的悬停?

                  What rules i have to apply to achieve that effect? Does JS recognize a hover in a option element?

                  推荐答案

                  你可以试试这样的:

                  #select {
                    width: 100px;
                  }
                  
                  select:hover {
                    color: #444645;
                    background: green;
                    /* hover on select */
                  }
                  
                  select:focus>option:checked {
                    background: yellow;
                    /* selected */
                  }

                  <select id="select">
                    <option value="1">One</option>
                    <option value="2">Two</option>
                    <option value="3">Three</option>
                  </select>

                  如果你需要选项列表的作弊码,那么你可以试试这个:

                  If you need a cheat code for the options list then you can try this:

                  #select {
                    width: 100px;
                  }
                  
                  select:hover {
                    color: #444645;
                    background: green;
                    /* hover on select */
                  }
                  
                  select option {
                    color: #444645;
                    background: red;
                    /* hover on select */
                  }
                  
                  option:hover {
                    /*optional rendered */
                    background-color: teal;
                  }

                  <select onfocus='this.size=9;' onblur='this.size=0;' onchange='this.size=1; this.blur();' id="select">
                    <option value="1">One</option>
                    <option value="2">Two</option>
                    <option value="3">Three</option>
                    <option value="4">Four</option>
                    <option value="5">Five</option>
                    <option value="6">Six</option>
                    <option value="7">Seven</option>
                    <option value="8">Eight</option>
                    <option value="9">Nine</option>
                  </select>

                  这篇关于如何在悬停时更改选择选项的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:fetch请求返回的中间结果应该调用什么?一个blob还是只是响应? 下一篇:在 React JS 中使用路由器时如何使用 Context API 传递状态

                  相关文章

                    <bdo id='ORbZp'></bdo><ul id='ORbZp'></ul>
                  1. <i id='ORbZp'><tr id='ORbZp'><dt id='ORbZp'><q id='ORbZp'><span id='ORbZp'><b id='ORbZp'><form id='ORbZp'><ins id='ORbZp'></ins><ul id='ORbZp'></ul><sub id='ORbZp'></sub></form><legend id='ORbZp'></legend><bdo id='ORbZp'><pre id='ORbZp'><center id='ORbZp'></center></pre></bdo></b><th id='ORbZp'></th></span></q></dt></tr></i><div id='ORbZp'><tfoot id='ORbZp'></tfoot><dl id='ORbZp'><fieldset id='ORbZp'></fieldset></dl></div>
                    <tfoot id='ORbZp'></tfoot>
                  2. <legend id='ORbZp'><style id='ORbZp'><dir id='ORbZp'><q id='ORbZp'></q></dir></style></legend>

                    1. <small id='ORbZp'></small><noframes id='ORbZp'>