I have the following code:
<!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>
my qustion is:
How can I do (without JS is better) that whan I put the mouse on “stam” div – the “box1” div will move (will do the animation in the code)?
I added my code (which isn’t work).
Wish for help. Thank you!
If your
#stamis going to be after your#box1you can use the~selector – DEMO