<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 设置为在父悬停时更改颜色,但在悬停时也会更改

        CSS :: child set to change color on parent hover, but changes also when hovered itself(CSS :: child 设置为在父悬停时更改颜色,但在悬停时也会更改)
        <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 设置为在父悬停时更改颜色,但在悬停时也会更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Charts.js scales yaxes ticks min max doesnt work(Charts.js 缩放 yaxes 刻度 min max 不起作用)
                  How to expand the slice of donut chart in chartjs?(如何在chartjs中扩展圆环图的切片?)
                  chartjs time cartesian axis adapter and date library setup(chartjs 时间笛卡尔轴适配器和日期库设置)
                  How to apply gradient color in chart.js?(如何在 chart.js 中应用渐变颜色?)
                  Side effects from Chartjs for only *some* clients(Chartjs 的副作用仅适用于 *一些* 客户)
                  Chart js different background for y axis(图表 js y 轴的不同背景)

                  <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>
                              <tbody id='bDeGV'></tbody>