旋转中缩放的变化
来源:3-3 编程练习
吃了饿饿了又吃
2017-01-18 01:09:49
老师,同学,
我有个问题,就是这个放大一倍;我是通过调整width和height,以及字体,行高。就有了这个问题:鼠标放上去,立即变大,再旋转。移开,马上变小,再旋转。
如果设置scale,要么没效果,要么就是只放大,其他动画没效果了。
<html>
<head>
<meta charset="UTF-8">
<title>3-2作业</title>
<style>
div {
font-size: 14px;
font-weight: bold;
line-height: 50px;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 200px;
height: 50px;
margin: auto;
cursor: pointer;
text-align: center;
background: #abcdef;
/*此处写代码*/
transform: rotate(0deg);
-webkit-transition: transform 2s ease-in-out 0.5s;
-moz-transition: transform 2s ease-in-out 0.5s;
-ms-transition: transform 2s ease-in-out 0.5s;
-o-transition: transform 2s ease-in-out 0.5s;
transition: transform 2s ease-in-out 0.5s;
}
/*此处写代码*/
div:hover {
font-size: 1.5em;
font-weight: bold;
line-height: 100px;
width: 400px;
height: 100px;
margin: auto;
/* transform: scale(2, 2); */
cursor: pointer;
transform: rotate(360deg);
-webkit-transition: transform 2s ease-in-out 0.5s;
-moz-transition: transform 2s ease-in-out 0.5s;
-ms-transition: transform 2s ease-in-out 0.5s;
-o-transition: transform 2s ease-in-out 0.5s;
transition: transform 2s ease-in-out 0.5s;
}
</style>
</head>
<body>
<div>www.imooc.com</div>
</body>
</html>1回答
吃了饿饿了又吃
提问者
2017-01-18
ok,看到了老师的代码了,已经可以了。但有疑问,为什么要删除原先的transform: rotate(0deg);之前的案例是加的,还是因为旋转360°的原因?
相似问题