Ver Mensaje Individual
  #6 (permalink)  
Antiguo 04/10/2016, 17:46
jorgecanto
 
Fecha de Ingreso: abril-2015
Mensajes: 16
Antigüedad: 9 años
Puntos: 4
Respuesta: Al rotar un div con CSS se desplaza de lugar

Prueba a envolverlo todo en un contenedor y darle un display flex para centrar el círculo. Parece que es el translate lo que te está dando problemas.

Código CSS:
Ver original
  1. .contenedor {
  2.   position:absolute;
  3.   display:flex;
  4.   width:100%;
  5.   height:100%;
  6. }
  7. div#circulo {
  8.   margin:auto;
  9.     width:250px;
  10.     height:200px;  
  11.     box-sizing: border-box;
  12.     -webkit-box-sizing: border-box;
  13.     -moz-box-sizing: border-box;
  14.     -webkit-animation-name: opacidad, giro;
  15.     -webkit-animation-duration: 2s, 2s;
  16.     -moz-animation-name: opacidad, giro;
  17.     -moz-animation-duration: 2s, 2s;
  18.     animation-name: opacidad, giro;
  19.     animation-duration: 2s, 2s;    
  20. }
  21.  
  22. @-webkit-keyframes opacidad {
  23.     from { -webkit-opacity: 0;}
  24.     to   { -webkit-opacity: 1;}
  25. }
  26.  
  27. @-moz-keyframes opacidad {
  28.     from { -moz-opacity: 0;}
  29.     to   { -moz-opacity: 1;}
  30. }
  31.  
  32. @-webkit-keyframes giro {
  33.     from { -webkit-transform: rotate(0turn);}
  34.     to   { -webkit-transform: rotate(15turn);}
  35. }
  36.  
  37. @-moz-keyframes giro {
  38.     from { -moz-transform: rotate(0turn);}
  39.     to   { -moz-transform: rotate(15turn);}
  40. }
  41.  
  42. div#circulo:hover {
  43.    opacity: 0.9;
  44.    transform: scale(1.1);
  45. }