<tfoot id='f7F94'></tfoot><legend id='f7F94'><style id='f7F94'><dir id='f7F94'><q id='f7F94'></q></dir></style></legend>
  • <small id='f7F94'></small><noframes id='f7F94'>

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

          <bdo id='f7F94'></bdo><ul id='f7F94'></ul>

      1. CSS :: child 设置为在父悬停时更改颜色,但在悬停时也会更改

        时间:2023-11-01
        <tfoot id='0Qusa'></tfoot>

        • <bdo id='0Qusa'></bdo><ul id='0Qusa'></ul>

        • <small id='0Qusa'></small><noframes id='0Qusa'>

            <tbody id='0Qusa'></tbody>

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

                  本文介绍了CSS :: child 设置为在父悬停时更改颜色,但在悬停时也会更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I have an <a> with a <span> children. I have written some CSS which changes the border-color of the children when the parent is hovered, but it also changes the border-color when I hover the children, which it shouldn't.

                  a {
                      padding: 50px;
                      border: 1px solid black;
                  }
                  
                  a span {
                      position: absolute;
                      top: 200px;
                      padding: 30px;
                      border: 10px solid green;
                  }
                  
                  a:hover span {
                      border: 10px solid red;
                  }   

                  <a>
                      Parent text
                      <span>Child text</span>    
                  </a>

                  解决方案

                  Update

                  The below made sense for 2013. However, now, I would use the :not() selector as described below.


                  CSS can be overwritten.

                  DEMO: http://jsfiddle.net/persianturtle/J4SUb/

                  Use this:

                  .parent {
                    padding: 50px;
                    border: 1px solid black;
                  }
                  
                  .parent span {
                    position: absolute;
                    top: 200px;
                    padding: 30px;
                    border: 10px solid green;
                  }
                  
                  .parent:hover span {
                    border: 10px solid red;
                  }
                  
                  .parent span:hover {
                    border: 10px solid green;
                  }

                  <a class="parent">
                      Parent text
                      <span>Child text</span>    
                  </a>

                  这篇关于CSS :: child 设置为在父悬停时更改颜色,但在悬停时也会更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Jquery停止淡入/淡出 下一篇:您可以在 Firebug 中设置悬停状态“粘性"吗?

                  相关文章

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

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

                    <legend id='bDeGV'><style id='bDeGV'><dir id='bDeGV'><q id='bDeGV'></q></dir></style></legend>