   [web] Resizing html tables and images
  Hi, I am trying to create a table with images inside cells and I want the whole table to scale down when the browser window is resized. I also want to keep the aspect ratio fixed.So far I tried this but couldn't get it to work properly.<html><head><script type="text/javascript">function onWindowResized(){div = document.getElementById("myDiv");if (window.innerWidth > window.innerHeight){div.height = window.innerHeight;div.width = window.innerHeight;}else{div.width = window.innerWidth;div.height = window.innerWidth;}}</script> </head><body bgcolor="black" onresize="onWindowResized()"><div id="myDiv"><table id="mainTable" width="100%" height="56%" border="1" align="center"><tr width="100%" height="10%"><td colspan="2"><!-- <img width="100%" height ="100%" src="images/frame_top.gif"/> --></td></tr><tr width="100%" height="80%"><td width="70%" ><script type="text/javascript">for(i=0; i<10; i++){for(k=0; k<15; k++){document.write("<img width=\"6.66%\" height=\"10%\" src=\"images/city.png\"/>");}}</script></td><td width="30%" ><!-- <img width="100%" height ="100%" src="images/frame_right.gif"/> --></td></tr><tr width="100%" height="10%"><td colspan="2"><!-- <img width="100%" height ="100%" src="images/frame_bottom.gif"/> --></td></tr></table></div></body></html>Any idea how I can achieve this ?[Edited by - Black Knight on May 9, 2010 8:44:27 PM]
  Like this?<table border="1" width="100%">  <tr>    <td><img src="http://www.gamedev.net/community/forums/images/avatars/25329.png" width="100%" /></td>    <td><img src="http://www.gamedev.net/community/forums/images/avatars/25329.png" width="100%" /></td>    <td><img src="http://www.gamedev.net/community/forums/images/avatars/25329.png" width="100%" /></td>  </tr></table>Should scale horizontally while keeping the aspect ratio of the images intact.By the way, I'm not sure why you would need any sort of scripting here, but perhaps I misunderstood the problem. :)   ;  The problem with this is it doesn't scale the table when you reduce the height of the browser.I was looking for a way to scale the table and all contents to make them always visible depending on window size.This is the test website I'm working on.test