【问题标题】:How can I scale and rotate a rounded search btn?如何缩放和旋转圆形搜索 btn?
【发布时间】:2013-07-20 19:20:25
【问题描述】:

我已经四舍五入提交 btn,我想从一开始就缩放到 80%,当我悬停它时,我希望它缩放到 100% 并旋转 360 度。这是代码,我在网上找不到任何答案。

header #searchbtn{
background: url(../img/roundedsearchbtn.png) no-repeat;
border: 0;
cursor: pointer;
display: inline-block;
float: right;
height: 41px;
filter: alpha(opacity=60);
opacity: 0.60;

-webkit-transition: all 0.3s linear;
-moz-transition: all 0.3s linear;
-o-transition: all 0.3s linear;
transition: all 0.3s linear;

overflow: hidden;
text-indent: 100%;
width: 41px;

-webkit-transform: scale(0.8);
-moz-transform: scale(0.8);
-ms-transform: scale(0.8);
-o-transform: scale(0.8);
-transform: scale(0.8);
}

header #searchbtn:hover, header #searchbtn:focus {
filter: alpha(opacity=100);
opacity: 1;

-webkit-transform: rotate(360deg) scale(1);
-moz-transform: rotate(360deg) scale(1);
-ms-transform: rotate(360deg) scale(1);
-o-transform: rotate(360deg) scale(1);
-transform: rotate(360deg) scale(1);
}

【问题讨论】:

  • 你能提供一个小提琴吗?

标签: css rotation transform scale


【解决方案1】:

这就是你想要的? Fiddle

只需添加这些 CSS 规则:

button {
    -webkit-transform: rotate(0) scale(.8,.8);
    -moz-transform: rotate(0) scale(.8,.8);
    transform: rotate(0) scale(.8,.8);
}

button:hover {
    -webkit-transform: rotate(360deg) scale(1,1);
    -moz-transform: rotate(360deg) scale(1,1);
    transform: rotate(360deg) scale(1,1);
}

【讨论】:

  • 非常感谢,这正是我想要的。
  • @Cherniv 谢谢!通常,您必须在 CSS 中保持一致以避免冲突。 Vartox 很高兴为您提供帮助!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-03-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多