<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. 如何在悬停时更改选择选项的背景颜色

        How to change the background color of a select option on hover(如何在悬停时更改选择选项的背景颜色)

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

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

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Pause youtube video, youtube api(暂停 youtube 视频,youtube api)
                  Youtube iframe api not triggering onYouTubeIframeAPIReady(Youtube iframe api 未触发 onYouTubeIframeAPIReady)
                  How can I stop a video with Javascript in Youtube?(如何在 Youtube 中停止使用 Javascript 的视频?)
                  Embed YouTube video - Refused to display in a frame because it set #39;X-Frame-Options#39; to #39;SAMEORIGIN#39;(嵌入 YouTube 视频 - 拒绝显示在框架中,因为它将“X-Frame-Options设置为“SAMEORIGIN)
                  How to call Greasemonkey#39;s GM_ functions from code that must run in the target page scope?(如何从必须在目标页面范围内运行的代码中调用 Greasemonkey 的 GM_ 函数?)
                  How do you mute an embedded Youtube player?(如何使嵌入式 Youtube 播放器静音?)
                      <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>
                          <tbody id='ORbZp'></tbody>
                        • <legend id='ORbZp'><style id='ORbZp'><dir id='ORbZp'><q id='ORbZp'></q></dir></style></legend>

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