关于html元素中心点问题。
本文介绍了关于html元素中心点问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
如果写一个元素,那么他是从左上开始的,我现在画了一个圆加了点动画,这个圆也是从左上开始,如何把左上位置移动到圆的中心呢?谢谢!
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
div{ width:100px;
height:100px;
border-radius:50%;
background:#9CF;
animation:move linear 3s infinite;
}
@keyframes move{
0%{width:100px;
height:100px; }
50%{width:50px;
height:50px; }
50%{width:0px;
height:0px; }
}
</style>
</head>
<body>
<div></div>
</body>
</html>
解决方案
@keyframes move{
0%{transform: scale(1,1) }
50%{transform: scale(2,2) }
50%{transform: scale(0,0) }
}
这篇关于关于html元素中心点问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文