Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/01/2012, 15:12
kseso?
Colaborador
 
Fecha de Ingreso: junio-2007
Mensajes: 5.798
Antigüedad: 16 años, 11 meses
Puntos: 539
Respuesta: Z Index Superposicion de objetos y texto

2 contenedores posicionados con "relative" nunca se podrán superponer. Ocuparan dos líneas horizontales diferentes.

Si un elemento lo posiciona sobre otro también lo hará todo lo contenido en él. A no ser que...
Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <meta charset="UTF-8">
  3. <title>Kseso? jugando con css</title>
  4. <style type="text/css">
  5.  .div1 {
  6.     background: red;
  7.     height: 148px;
  8.     width: 174px;
  9.     z-index: 2;
  10.     position: absolute;
  11.     top: 0;
  12.     left: 0;
  13. }
  14. .div2 {
  15.     background: blue;
  16.     height: 288px;
  17.     width: 174px;
  18.     position: relative;
  19. }
  20. span {
  21.     text-align: center;
  22.     position: relative;
  23.     z-index: 3;
  24. }
  25.  </style>
  26. </head>
  27.     <div class="div2"><span>asd</span></div>
  28.     <div class="div1"></div>
  29. </body>
  30. </html>