You need to animate an element in CSS. It is necessary to make it so that when you hover over the text, the image that rotates before the text. A picture is a text . Direct the cursor to the text and the picture makes a complete rotation around the axis.
.img { top: -10px; right: -10px; padding: 0; width: 20px; height: 20px; border: 2px solid #ccc; -webkit-border-radius: 15px; -moz-border-radius: 15px; -ms-border-radius: 15px; -o-border-radius: 15px; border-radius: 15px; -webkit-box-shadow: 0px 0px 10px #000; -moz-box-shadow: 0px 0px 10px #000; box-shadow: 0px 0px 10px #000; -webkit-transition: all ease .8s; -moz-transition: all ease .8s; -ms-transition: all ease .8s; -o-transition: all ease .8s; transition: all ease .8s; } .text:hover ~ .img { -webkit-transform: rotate(360deg); -moz-transform: rotate(360deg); -ms-transform: rotate(360deg); -o-transform: rotate(360deg); transform: rotate(360deg); } Currently it works only if the picture comes after the text. If you put the text - the picture - then everything works. Here is the html code:
<img class="img" src="/images/copy.jpg" alt="Не работает" /> <p class="text">123</p> <img class="img" src="/images/copy.jpg" alt="Работает" /> Ideally, do this:
<a class="text" href=""> <img class="img" src="/images/copy.jpg" alt="Имя" />Сообщение</a> That is, to make it so that when you hover over a link, the image that is in it is scrolled. In this case, the text itself is in place.