【问题标题】:CSS hover rotate: blurred and weird textCSS悬停旋转:模糊和奇怪的文本
【发布时间】:2017-01-03 17:05:42
【问题描述】:

我有一些带有内部文字的圆圈。当我将鼠标悬停在它上面进行旋转时,文本会变得模糊并且有点混乱,直到旋转结束。所以会好起来的。 它发生在所有浏览器中。

我尝试了一些答案,例如this one,但没有奏效。

html

<div class="circle">
  <div class="inner-circle">
      <div class="dotted-circle">
          <div class="circle__wrapper">
              <div class="circle__content">
                  Magic Touch Detox
              </div>
          </div>
      </div>
  </div>
</div>

css

.treatframe .circle {
  position: relative;
  display: block;
  margin-top: -6em;
  background-color: transparent;
  color: #222;
  text-align: center;
  z-index: 1;
}

.circle:after {
  display: block;
  margin-left: auto !important;
  margin-right: auto !important;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background-color: #c6c;
  content: "";
}

.dotted-circle {
  display: block;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-top: 5px;
  width: 160px;
  height: 160px;
  border: 5px dotted #fff;
  border-radius: 50%;
  background-color: #c6c;   
}

.treatframe .circle .inner-circle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 1;
  -webkit-transition-duration: 1s;
  -moz-transition-duration: 1s;
  -o-transition-duration: 1s;
  transition-duration: 1s;
}

.treatframe .circle .inner-circle:hover {
  -webkit-transform: rotate(7deg);/* Chrome, Safari, Opera */
  -moz-transform: rotate(7deg);
  -o-transform: rotate(7deg);
  -ms-transform: rotate(7deg);/* IE 9 */
  transform: rotate(7deg);
  -webkit-transition-duration: 1s;
  -moz-transition-duration: 1s;
  -o-transition-duration: 1s;
  transition-duration: 1s;
} 

.circle__wrapper {
 display: table;
 width: 100%;
 height: 100%;
}

.circle__content {
  display: table-cell;
  padding: 1em;
  vertical-align: middle;
  font-size: 20px;
  font-weight: bold;
  color: #fff;
}

【问题讨论】:

    标签: html css


    【解决方案1】:

    我刚刚尝试了我的 MBP Retina / Chrome 55,我的一切看起来都很好。

    你有什么样的设置/配置?

    【讨论】:

      【解决方案2】:

      CSS 变换在计算子像素值时经常会导致模糊,这只是野兽的本性。

      一种解决方案是向容器添加透视和背面可见性值

      .circle {
        position: relative;
        display: block;
        margin-top: -6em;
        background-color: transparent;
        color: #222;
        text-align: center;
        z-index: 1;
      }
      
      .circle:after {
        display: block;
        margin-left: auto !important;
        margin-right: auto !important;
        width: 170px;
        height: 170px;
        border-radius: 50%;
        background-color: #c6c;
        content: "";
      }
      
      .dotted-circle {
        display: block;
        margin-left: auto !important;
        margin-right: auto !important;
        margin-top: 5px;
        width: 160px;
        height: 160px;
        border: 5px dotted #fff;
        border-radius: 50%;
        background-color: #c6c;   
      }
      
      .circle .inner-circle {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 1;
        -webkit-transition-duration: 1s;
        -moz-transition-duration: 1s;
        -o-transition-duration: 1s;
        transition-duration: 1s;
      }
      
      .circle .inner-circle:hover {
        -webkit-transform: rotate(7deg);/* Chrome, Safari, Opera */
        -moz-transform: rotate(7deg);
        -o-transform: rotate(7deg);
        -ms-transform: rotate(7deg);/* IE 9 */
        transform: rotate(7deg);
        -webkit-transition-duration: 1s;
        -moz-transition-duration: 1s;
        -o-transition-duration: 1s;
        transition-duration: 1s;
      } 
      
      .circle__wrapper {
       display: table;
       width: 100%;
       height: 100%;
      }
      
      .circle__content {
        backface-visibility: hidden;
        display: table-cell;
        padding: 1em;
        vertical-align: middle;
        font-size: 20px;
        font-weight: bold;
        color: #fff;
      }
      <html>
      <head>
      </head>
      <body>
      <div class="circle">
        <div class="inner-circle">
            <div class="dotted-circle">
                <div class="circle__wrapper">
                    <div class="circle__content">
                        Magic Touch Detox
                    </div>
                </div>
            </div>
        </div>
      </div> 
      </body>
      </html>

      【讨论】:

      • 这不是我认为的问题的答案。 " 当我将鼠标悬停在其上进行旋转时,文本会变得模糊且有点混乱,直到旋转结束"
      • 同样的事情。你的 sn-p 也一样。
      猜你喜欢
      • 1970-01-01
      • 2019-03-06
      • 1970-01-01
      • 1970-01-01
      • 2011-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多