7th Nov 2020, 12:59 PM
ABC
5 odpowiedzi
+ 6
Just change values of top and left like: top :50px; left :50px; Then I got it centered. (but bcos of using px instead of % ,this website won't be responsive)
7th Nov 2020, 1:12 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 6
ABC Ok then try adjusting the values of top and left yourself. Like : top :5%; left :5%; This almost makes it centered.
7th Nov 2020, 2:46 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 2
Do you like this: <style> body { width: 100vw; height: 100vh; } div{ width: 200px; height: 200px; border: 20px solid #efefef; border-radius: 50%; position: absolute; margin-left: 30vw; margin-top: 35vh; border-bottom: 20px solid dodgerblue; animation: anim 2s linear infinite; } @keyframes anim{ from{ transform: rotate(0deg); } to{ transform: rotate(360deg); } } </style>
7th Nov 2020, 3:00 PM
JaScript
JaScript - avatar
+ 2
You have to translate then rotate not the opposite... make the animation like: @keyframes anim{ from{ transform: translate(-50%, -50%) rotate(0); } to{ transform: translate(-50%, -50%) rotate(360deg); } } Its counter intuitive but order applied is from right to left with respect the transform functions... In practice when apply more transform function, you have to write in opposite order
7th Nov 2020, 6:03 PM
KrOW
KrOW - avatar
+ 1
Alphin K Sajan but I need responsiveness
7th Nov 2020, 1:34 PM
ABC