max-width
andmax-height
プロパティを使用し100%
て、画像がセルを超えないようにすることができます。途中でフィドルがやってくる!:)
HTML
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td><img src="http://windows7supportnow.com/wp-content/uploads/2012/06/Windows-vista-help-1.jpg" class="normal" /></td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
</tr>
<tr>
<td>Table Cell</td>
<td>Table Cell</td>
<td><img src="http://windows7supportnow.com/wp-content/uploads/2012/06/Windows-vista-help-1.jpg" class="fullsize" /></td>
<td>Table Cell</td>
</tr>
<tr>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
</tr>
<tr>
<td><img class="normal" src="http://edibleapple.com/wp-content/uploads/2009/04/silver-apple-logo.png" /></td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
</tr>
</table>
JavaScript
$(document).ready(function(){
$("img").click(function(){
$(this).toggleClass("normal");
});
});
CSS
td, td img.normal, img.fullsize.normal {height: 100px; max-height: 100px; width: 100px; max-width: 100px;}
td {position: relative;}
img.fullsize {position: absolute; top: 0; left: 0; z-index: 100; height: auto; max-height: auto; width: auto; max-width: auto;}
プレビューとデモ