Ver Mensaje Individual
  #20 (permalink)  
Antiguo 07/04/2015, 15:36
Avatar de mardojai
mardojai
 
Fecha de Ingreso: noviembre-2012
Ubicación: Lima, Perú
Mensajes: 137
Antigüedad: 11 años, 5 meses
Puntos: 44
Respuesta: efecto para armar figura

Con css seria así:

Estructura de archivos:
  • index.html
  • style.css

index.html
Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <html lang="es">
  3.     <head>
  4.         <title>Animaci&oacute;n Jquery</title>
  5.        
  6.         <!-- Incluimos el css -->
  7.         <link rel="stylesheet" type="text/css" href="style.css" />
  8.        
  9.         </head>
  10.     <body>
  11.         <div id="banner">
  12.             <div id="devices">
  13.                 <!-- Cada dispositivo lo pondremos como un div -->
  14.                 <div class="device laptop"></div>
  15.                 <div class="device tablet"></div>
  16.                 <div class="device phone"></div>
  17.             </div>
  18.         </div>
  19.         <!-- Div de relleno -->
  20.         <div id="content">
  21.                        
  22.         </div>
  23.     </body>
  24. </html>

style.css
Código CSS:
Ver original
  1. html, body {
  2.     margin: 0;
  3.     overflow-x: hidden;
  4. }
  5.  
  6. #banner {
  7.     background: #EEE;
  8.     height: 380px;
  9. }
  10.  
  11. #devices {    
  12.     height: 380px;
  13.     margin: 0px auto;
  14.     position: relative;
  15.     width: 700px;
  16. }
  17.  
  18. .device {
  19.     position: absolute;
  20. }
  21.  
  22. .laptop {
  23.     animation: laptop 1.5s;
  24.     -webkit-animation: laptop 1.5s;
  25.     background: #666;
  26.     height: 300px;
  27.     width: 450px;
  28.     z-index: 2;
  29. }
  30.  
  31. .tablet {
  32.     animation: tablet 1.5s;
  33.     -webkit-animation: tablet 1.5s;
  34.     background: #363636;
  35.     height: 200px;
  36.     right: 0px;
  37.     top: 100px;
  38.     width: 300px;
  39.     z-index: 1;
  40. }
  41.  
  42. .phone {
  43.     animation: phone 1.5s;
  44.     -webkit-animation: phone 1.5s;
  45.     background: #085ed3;
  46.     bottom: 0px;
  47.     height: 180px;
  48.     left: 400px;
  49.     width: 100px;
  50.     z-index: 3;
  51. }
  52.  
  53. @-webkit-keyframes laptop {
  54.     from {left: -800px;}
  55.     to {left: 0px;}
  56. }
  57. @keyframes laptop {
  58.     from {left: -800px;}
  59.     to {left: 0px;}
  60. }
  61.  
  62. @-webkit-keyframes tablet {
  63.     from {right: -800px;}
  64.     to {right: 0px;}
  65. }
  66. @keyframes tablet {
  67.     from {right: -800px;}
  68.     to {right: 0px;}
  69. }
  70.  
  71. @-webkit-keyframes phone {
  72.     from {bottom: -400px;}
  73.     to {bottom: 0px;}
  74. }
  75. @keyframes phone {
  76.     from {bottom: -400px;}
  77.     to {bottom: 0px;}
  78. }
  79.  
  80. #content {
  81.     background: #000;
  82.     color: #FFF;
  83.     height: 800px;
  84.     position: relative;
  85.     z-index: 9999;
  86. }

Ejemplo: https://jsfiddle.net/21aoLz1j/1/embedded/result/

Saludos!
__________________
El que supera a otros es poderoso, y el que se supera a sí mismo es invencible.
__________________
Si te sirvió puntúa.

Última edición por mardojai; 07/04/2015 a las 15:41