Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/08/2011, 09:07
Avatar de cristian_cena
cristian_cena
Colaborador
 
Fecha de Ingreso: junio-2009
Mensajes: 2.244
Antigüedad: 14 años, 10 meses
Puntos: 269
Respuesta: Diseño flexible :: Porcentajes diferentes a div principal

Para esto ya deberías usar javascript. Si usas jquery debes usar rezise();

Te comparto un ejemplo. Luego lo adaptas a tu necesidad:


Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4.     <title>Documento sin título</title>
  5.     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
  6.     <script type="text/javascript">
  7.         $(document).ready(function(){
  8.             var windowWidth = $(window).width(); //retrieve current window width
  9.             var windowHeight = $(window).height(); //retrieve current window height
  10.             var documentWidth = $(document).width(); //retrieve current document width
  11.             var documentHeight = $(document).height(); //retrieve current document height
  12.             var vScrollPosition = $(document).scrollTop(); //retrieve the document scroll ToP position
  13.             var hScrollPosition = $(document).scrollLeft(); //retrieve the document scroll Left position
  14.            
  15.             $('#window').html("<b>ancho inicial</b>: "+windowWidth+"px, <b>alto inicial</b>: "+windowHeight+"px");
  16.            
  17.             $(window).resize(function() {
  18.             $('#wx').val($(window).width()+"px");
  19.             $('#wy').val($(window).height()+"px");
  20.             });
  21.         });
  22.     </script>
  23. </head>
  24.     <div id="window"></div>
  25.     <b>ancho actual</b>:
  26.     <input type="text" id="wx"/>
  27.     <b>alto actual</b>:
  28.     <input type="text" id="wy"/>
  29. </body>
  30. </html>

Saludos.