日期:2014-05-17  浏览次数:20685 次

如何不让图片撑大表格?
大家不让字符撑大表格都是这样写:
<table       width= "200 "       style= "word-break:break-all ">      
但为什么我放图片进去表格里,还是会撑大的呢?

————————————————
<html>
<title>
</title>
<body>
<table       style= "word-break:break-all ">      
    <td       width=20> <img   src=BB.JPG> </td>      
    </table>

</body>
</html>

------解决方案--------------------
图片又不是像文字那样超出部分可以隐藏掉~~~
设置图片大小就行啦,要不把图片设置成td的背景....
------解决方案--------------------
<table style= "table-layout:fixed; ">
------解决方案--------------------
用 <table style= "table-layout:fixed; "> 的话超出的部分不就被裁掉了?能不能让图片自动符合表格的大小哈?

------解决方案--------------------
你最好设置一下图片大小,如果想自动符合表格可能要用编程的方法控制css里面图片高宽了
------解决方案--------------------
<html>
<title>
</title>
<body>
<table >
<td width=50> <img src= "http://www.baidu.com/img/logo-yy.gif " width=100% > </td>
</table>

</body>
</html>
------解决方案--------------------
裁一下图片的大小吧
------解决方案--------------------
<td width=50> <img src= "http://www.baidu.com/img/logo-yy.gif " width=100% > </td>

————————————————
JK——10000兄弟能讲解一下为什么上面这写法就能自动缩放么?

--------------------------------

把图片的width设置为100%,这个100%就是td的实际宽
------解决方案--------------------
String that specifies an integer value followed by a %.
The value is a percentage of the width of the parent object.

If you specify the width property of an img, but not the height property, the resulting height of the img is sized proportionally to the specified width property and the actual height, in pixels, of the source image file.

If you specify the width property of an img, and the height and width of the image in the source file are identical, the height of the image matches the width.

If you specify the height property and the width property of an img, the resulting image dimensions match the height and width specified.

When scripting the height property, use either the pixelHeight or posHeight property to numerically manipulate the height value.

If dynamic changes are intended for the height and width, the original values should be set through style (e.g. "style= ' 'height:200px; width:200px ' ') rather than through the height and width attributes.

Although you can specify the width as a percentage, this property always retrieves the width in pixels.