我有以下代码:
<!DOCTYPE HTML>
<html>
<head>
<title>What</title>
<style type="text/css">
#box1
{
position: relative;
width: 300px;
border: 1px solid black;
box-shadow: -3px 8px 34px #808080;
border-radius: 20px;
box-shadow: -8px 5px 5px #888888;
right: 100px; top: 50px;
height: 150px;
}
#box1:hover {
}
@-webkit-keyframes myfirst
{
0% { right:100px; top:50px;background: yellow;}
50% {background:blue; right:700px; top:50px;}
100% { right:100px; top:50px; background: yellow}
}
#stam {font-size: large;
background: green;
width: 100px;
top: 400px;
position: absolute;
}
#stam:hover { -webkit-animation:myfirst 5s;
}
</style>
</head>
<body dir="rtl">
<div id="box1"></div>
<div id="stam">1234567</div>
</body>
</html>
我的问题是:当我将鼠标放在“stam”div 上时,我该怎么做(没有 JS 更好) - “box1” div 会移动(将在代码中制作动画)?我添加了我的代码(这是行不通的)。希望得到帮助。谢谢!