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

    <legend id='9bbYs'><style id='9bbYs'><dir id='9bbYs'><q id='9bbYs'></q></dir></style></legend>

    <small id='9bbYs'></small><noframes id='9bbYs'>

    <tfoot id='9bbYs'></tfoot>
    • <bdo id='9bbYs'></bdo><ul id='9bbYs'></ul>

    1. :hover (鼠标离开时)的反义词是什么?

      时间:2023-11-01
      • <bdo id='DAurq'></bdo><ul id='DAurq'></ul>

          1. <tfoot id='DAurq'></tfoot>
            <legend id='DAurq'><style id='DAurq'><dir id='DAurq'><q id='DAurq'></q></dir></style></legend>

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

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

                  <tbody id='DAurq'></tbody>
              • 本文介绍了:hover (鼠标离开时)的反义词是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                有什么方法可以与 :hover 仅使用 CSS相反?如:如果 :hoveron Mouse Enter,是否有相当于 on Mouse Leave 的 CSS?

                Is there any way to do the opposite of :hover using only CSS? As in: if :hover is on Mouse Enter, is there a CSS equivalent to on Mouse Leave?

                例子:

                我有一个使用列表项的 HTML 菜单.当我悬停其中一个项目时,会有一个从 #999black 的 CSS 颜色动画.如何在鼠标离开项目区域时创建相反的效果,动画从 black#999?

                I have a HTML menu using list items. When I hover one of the items, there is a CSS color animation from #999 to black. How can I create the opposite effect when the mouse leaves the item area, with an animation from black to #999?

                jsFiddle

                (请记住,我不想只回答这个例子,而是整个与:hover相反的问题.)

                (Have in mind that I do not wish to answer only this example, but the entire "opposite of :hover" issue.)

                推荐答案

                如果我理解正确,您可以通过将过渡移动到链接而不是悬停状态来做同样的事情:

                If I understand correctly you could do the same thing by moving your transitions to the link rather than the hover state:

                ul li a {
                    color:#999;       
                    transition: color 0.5s linear; /* vendorless fallback */
                    -o-transition: color 0.5s linear; /* opera */
                    -ms-transition: color 0.5s linear; /* IE 10 */
                    -moz-transition: color 0.5s linear; /* Firefox */
                    -webkit-transition: color 0.5s linear; /*safari and chrome */
                }
                
                ul li a:hover {
                    color:black;
                    cursor: pointer;
                }
                

                http://jsfiddle.net/spacebeers/sELKu/3/

                hover的定义是:

                :hover 选择器用于在鼠标悬停时选择元素他们.

                The :hover selector is used to select elements when you mouse over them.

                根据该定义,悬停的反义词是鼠标在其上方的任何点.比我聪明得多的人写了这篇文章,在两种状态下设置了不同的转换 - http://css-tricks.com/different-transitions-for-hover-on-hover-off/

                By that definition the opposite of hover is any point at which the mouse is not over it. Someone far smarter than me has done this article, setting different transitions on both states - http://css-tricks.com/different-transitions-for-hover-on-hover-off/

                #thing {
                   padding: 10px;
                   border-radius: 5px;
                
                  /* HOVER OFF */
                   -webkit-transition: padding 2s;
                }
                
                #thing:hover {
                   padding: 20px;
                   border-radius: 15px;
                
                  /* HOVER ON */
                   -webkit-transition: border-radius 2s;
                }
                

                这篇关于:hover (鼠标离开时)的反义词是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何使用 JavaScript 更改 CSS 属性 下一篇:更改所有元素的不透明度,除了悬停的元素

                相关文章

                <legend id='3Teg6'><style id='3Teg6'><dir id='3Teg6'><q id='3Teg6'></q></dir></style></legend>

                    <bdo id='3Teg6'></bdo><ul id='3Teg6'></ul>
                  <tfoot id='3Teg6'></tfoot>

                  <small id='3Teg6'></small><noframes id='3Teg6'>

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