Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rotate Circle with css hover [duplicate]

Tags:

html

css

I created an simple website:enter image description here

So there is an circle above an image, i tried to rotate it on hover, but it simply wont worked! Heres my code!

<div class="image" id="landkreis">
<img src="reg.png" alt="" width="100%" height="auto" />
<span id="motha2">
<h6><br>Here<br>i am</h6>
</span>
</div>

h6 {text-align:center;
color:#f2f2f2;
font-size: 75px;
line-height: 74px;
font-weight:700;
margin: 0 5px 24px;
font-family: 'Route';}

#motha2 {
position: absolute; 
top: 1px; 
left: 15%; 
width: 300px;
height:300px;
border-radius: 150px; 
background-color:#4ec461 ; } 

h6:hover {transform:rotate(-90deg);}

UPDATEUPDATE!!!!!!!!!!!!!!!!!!!!!!!!!!

Ok the transition works but how can i make the hole transition smooth and that for examle it first rotates -15deg an then to 15deg and stops finally at 0deg?

like image 862
Em Sta Avatar asked Dec 07 '22 07:12

Em Sta


1 Answers

If you need "rotates -15deg an then to 15deg and stops finally at 0deg"

You have to change

h6:hover {transform:rotate(-90deg);}

to

h6:hover {
    -moz-animation-name: rotate 1s linear 1;
    -webkit-animation-name: rotate 1s linear 1;
    animation-name: rotate 1s linear 1;
}
@-moz-keyframes rotate {
    0%, 100% {-moz-transform: rotate(0deg);}
    33% {-moz-transform: rotate(15deg);}
    66% {-moz-transform: rotate(-15deg);}
}
@-webkit-keyframes rotate {
    0%, 100% {-webkit-transform: rotate(0deg);}
    33% {-webkit-transform: rotate(15deg);}
    66% {-webkit-transform: rotate(-15deg);}
}
@keyframes rotate {
    0%, 100% {transform: rotate(0deg);}
    33% {transform: rotate(15deg);}
    66% {transform: rotate(-15deg);}
}
like image 105
Sivan Avatar answered Feb 17 '23 06:02

Sivan