0
点赞
收藏
分享

微信扫一扫

css定位+旋转动画(在指定位置旋转)

非衣所思 2022-04-04 阅读 96

<body>

<div></div>

</body>

<style>

body {

position: relative;

}

div {

position: absolute;

top: 0;

left: 50%;

transform: translate(-50%, -50%);

width: 100px;

height: 100px;

background-color: bisque;

border-radius: 30px;

/* 旋转重点 */

animation: rotate 1s linear infinite;

}

/* 定义旋转动画 */

@keyframes rotate {

from {

transform: translate(-50%, -50%) rotate(0deg);

}

to {

transform: translate(-50%, -50%) rotate(360deg);

}

}

</style>

举报

相关推荐

0 条评论