代码参考
<!DOCTYPE html>
<html><head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
*{
padding:0;
margin:0;
}
div{
width: 500px;
height: 500px;
border:1px solid red;
}
p{
width: 50px;
height: 50px;
background:blue;
margin-left:5px;
}
div:hover p{
margin-left:300px;
transition:all 3s;
/*transition 时间过渡
transition:需要时间过渡的属性/all 过渡时间长短;*/
}
</style>
</head>
<body>
<div>
<p></p>
</div>
</body>
</html>