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

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

      1. <tfoot id='XjlNE'></tfoot>
      2. <small id='XjlNE'></small><noframes id='XjlNE'>

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

        CSS 变换 - 保持悬停状态的价值

        CSS Transform - Keep value on hover state(CSS 变换 - 保持悬停状态的价值)
          <tbody id='UApqk'></tbody>

                <bdo id='UApqk'></bdo><ul id='UApqk'></ul>
                • <tfoot id='UApqk'></tfoot>
                • <legend id='UApqk'><style id='UApqk'><dir id='UApqk'><q id='UApqk'></q></dir></style></legend>

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

                  <i id='UApqk'><tr id='UApqk'><dt id='UApqk'><q id='UApqk'><span id='UApqk'><b id='UApqk'><form id='UApqk'><ins id='UApqk'></ins><ul id='UApqk'></ul><sub id='UApqk'></sub></form><legend id='UApqk'></legend><bdo id='UApqk'><pre id='UApqk'><center id='UApqk'></center></pre></bdo></b><th id='UApqk'></th></span></q></dt></tr></i><div id='UApqk'><tfoot id='UApqk'></tfoot><dl id='UApqk'><fieldset id='UApqk'></fieldset></dl></div>
                  本文介绍了CSS 变换 - 保持悬停状态的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I have transformed a box to rotate 10 and added a hover state to increase the size too.

                  .box {
                      margin: 0 auto;
                      background: blue;
                      width: 100px;
                      height: 100px;
                      -moz-transform: rotate(10deg);
                      -webkit-transform: rotate(10deg);
                      -o-transform: rotate(10deg);
                      -ms-transform: rotate(10deg);
                      transform: rotate(10deg);
                  }
                  .box:hover {
                      -moz-transform: scale(1.2) rotate(10deg);
                      -webkit-transform: scale(1.2) rotate(10deg);
                      -o-transform: scale(1.2) rotate(10deg);
                      -ms-transform: scale(1.2) rotate(10deg);
                      transform: scale(1.2) rotate(10deg);
                  }

                  <div class="box"></div>



                  Just for curiosity, I would like to know if there is a way where I don't have to add the 10 again on the hover state and it would keep the same value from the static state?

                  Maybe something similar to this:
                  .box:hover {transform: scale(1.2) rotate(inherit)}

                  解决方案

                  Not with "standard" CSS currently. Independent/individual transforms are coming though.

                  That said, CSS variables/custom properties can assist here.

                  Simply define the variable as the initial state scale(1) and on hover just change the variable rather than repeating the whole property set.

                  .box {
                    margin: 3em auto;
                    background: blue;
                    width: 100px;
                    height: 100px;
                    transition: transform .3s ease;
                    --scaler: 1;
                    transform: scale(var(--scaler)) rotate(10deg);
                  }
                  
                  .box:hover {
                    --scaler: 1.2;
                  }

                  <div class="box"></div>

                  这篇关于CSS 变换 - 保持悬停状态的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的区别?)

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

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

                    <tfoot id='dzKB4'></tfoot>
                      • <bdo id='dzKB4'></bdo><ul id='dzKB4'></ul>

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