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

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

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

      1. :active 与 :hover 不同时的样式按钮

        Style button when :active different from :hover(:active 与 :hover 不同时的样式按钮)

            • <bdo id='vgnvw'></bdo><ul id='vgnvw'></ul>

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

                <tbody id='vgnvw'></tbody>
              <legend id='vgnvw'><style id='vgnvw'><dir id='vgnvw'><q id='vgnvw'></q></dir></style></legend>
              <tfoot id='vgnvw'></tfoot>
                  <i id='vgnvw'><tr id='vgnvw'><dt id='vgnvw'><q id='vgnvw'><span id='vgnvw'><b id='vgnvw'><form id='vgnvw'><ins id='vgnvw'></ins><ul id='vgnvw'></ul><sub id='vgnvw'></sub></form><legend id='vgnvw'></legend><bdo id='vgnvw'><pre id='vgnvw'><center id='vgnvw'></center></pre></bdo></b><th id='vgnvw'></th></span></q></dt></tr></i><div id='vgnvw'><tfoot id='vgnvw'></tfoot><dl id='vgnvw'><fieldset id='vgnvw'></fieldset></dl></div>
                1. 本文介绍了:active 与 :hover 不同时的样式按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想制作一个在悬停时显示背景颜色的按钮,在按钮按下时显示没有背景颜色的按钮颜色.这是我当前的代码:

                  I want to make a button that displays a background color when hovering and a button color without a background color when the button is down. Here is my current code:

                  .windowButton:hover {
                      background-color:#1a82b8;
                  }
                  .windowButton:active #windowClose polygon {
                      fill:#1a82b8;
                  }
                  

                  上面代码的问题是它在 :active 时将图标变成了一种颜色,但没有删除 :hover 设置的背景颜色.如何去除背景色?

                  The problem with the above code is that it turns the icon a color when :active but doesn't remove the background color set by :hover. How do I remove the background color?

                  推荐答案

                  你必须在 :hover state 上设置一个新的背景颜色

                  You have to set a new background color on :hover state

                  .windowButton:hover {
                      background-color:#1a82b8;
                  }
                  .windowButton:active {
                     fill:#1a82b8;
                     background-color:#000000;/*You can put the color you want*/
                  }
                  

                  伪状态继承值.出于一致性目的,最好只在伪状态规则中声明您正在更改的样式.

                  Pseudo states inherit values. For consistency purposes, it is best to only declare the styles which you are changing in your pseudo state rules.

                  注意: :hover 必须在 :link:visited(如果它们存在)之后CSS定义,为了有效!

                  Note: :hover MUST come after :link and :visited (if they are present) in the CSS definition, in order to be effective!

                  这篇关于:active 与 :hover 不同时的样式按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的区别?)
                    <tbody id='BKRLx'></tbody>
                  <i id='BKRLx'><tr id='BKRLx'><dt id='BKRLx'><q id='BKRLx'><span id='BKRLx'><b id='BKRLx'><form id='BKRLx'><ins id='BKRLx'></ins><ul id='BKRLx'></ul><sub id='BKRLx'></sub></form><legend id='BKRLx'></legend><bdo id='BKRLx'><pre id='BKRLx'><center id='BKRLx'></center></pre></bdo></b><th id='BKRLx'></th></span></q></dt></tr></i><div id='BKRLx'><tfoot id='BKRLx'></tfoot><dl id='BKRLx'><fieldset id='BKRLx'></fieldset></dl></div>
                    <bdo id='BKRLx'></bdo><ul id='BKRLx'></ul>

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

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

                        <tfoot id='BKRLx'></tfoot>