• <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 变换 - 保持悬停状态的价值

        时间:2023-11-29
          <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 变换 - 保持悬停状态的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:我可以使悬停不可见的元素吗? 下一篇:Javascript“悬停时"环形

                  相关文章

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

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