<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

        Show :after when hovering over the parent element via CSS(通过 CSS 将鼠标悬停在父元素上时显示 :after)

        <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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Move link image 5px up on hover(悬停时将链接图像向上移动 5px)
                  How do I inspect CSS pseudo classes with firebug?(如何使用 firebug 检查 CSS 伪类?)
                  Why doesn#39;t CSS hover work on table rows when the cells inside the rows have class names?(当行内的单元格具有类名时,为什么 CSS 悬停在表格行上不起作用?)
                  Hover image - display div over it(悬停图像 - 在其上显示 div)
                  How to apply a CSS class on hover to dynamically generated submit buttons?(如何在悬停时将 CSS 类应用于动态生成的提交按钮?)
                  Differences between CSS3 :hover and :focus?(CSS3 :hover 和 :focus 的区别?)
                    <bdo id='aIdOO'></bdo><ul id='aIdOO'></ul>
                    <legend id='aIdOO'><style id='aIdOO'><dir id='aIdOO'><q id='aIdOO'></q></dir></style></legend>

                      <tbody id='aIdOO'></tbody>

                        • <small id='aIdOO'></small><noframes id='aIdOO'>

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