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

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

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

      2. 通过 CSS 将鼠标悬停在父元素上时显示 :after

        时间:2023-11-29

        <legend id='M6Avr'><style id='M6Avr'><dir id='M6Avr'><q id='M6Avr'></q></dir></style></legend>
            <bdo id='M6Avr'></bdo><ul id='M6Avr'></ul>

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

            2. <tfoot id='M6Avr'></tfoot>

                    <tbody id='M6Avr'></tbody>
                  本文介绍了通过 CSS 将鼠标悬停在父元素上时显示 :after的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当我将鼠标悬停在父元素本身上时,是否可以 display:block; :after 伪元素?

                  Is it possible to display:block; the :after pseudo-element when I hover over the parent element itself?

                  #myDiv{
                     position:relative;
                     width:50px;
                     height:50px;
                     border-style:solid;
                     background-color:red;
                  }
                  #myDiv:after{
                     position:absolute;
                     content:"";
                     display:none;
                     width:50px;
                     height:50px;
                     border-style:solid;
                     background-color:blue;
                  }
                  

                  我累了:

                  #myDiv:hover #myDiv:after{
                      display:block;
                  }
                  #myDiv:hover + #myDiv:after{
                      display:block;
                  }
                  #myDiv:hover > #myDiv:after{
                      display:block;
                  }
                  

                  但运气不好,这里有一个 fiddle.

                  Yet no luck, here's a fiddle.

                  推荐答案

                  改成#myDiv:hover::after

                  您可以使用 :after::after 但在选择器模块 (3) 中声明后者现在旨在用于将它们与伪类

                  You can use either :after or ::after but in the selectors module (3) it states that the latter is now intended to be used to distinguish them from pseudo-classes

                  这篇关于通过 CSS 将鼠标悬停在父元素上时显示 :after的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:旋转的两个元素之间的碰撞 下一篇:在 CSS 中的悬停覆盖图像上

                  相关文章

                    <bdo id='aIdOO'></bdo><ul id='aIdOO'></ul>
                  <legend id='aIdOO'><style id='aIdOO'><dir id='aIdOO'><q id='aIdOO'></q></dir></style></legend>

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

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