Monday, May 24, 2010

HTML: When i put an image in my table there is a white area around the image. How do i get rid of it?

I am taking internet programming but do not know much.

HTML: When i put an image in my table there is a white area around the image. How do i get rid of it?
adjust the cellpadding or cellspacing.





table cellpadding="0" cellspacing="0"





if that does not work there could be margins or padding assigned to the image or table cell.
Reply:I'm not exactly clear on what you want to do. If your image is not a square or rectangle, unless you turn your image into a transparent gif, all images will otherwise display inside of a rectangle with a white background.





It doesn't matter whether you display your image in a table or not. Unless your image background is the same color as your table cell background or your page background, your images will always have a white background.





Here's a link to a good tutorial on how to save an image as a transparent gif for the web. Gif images, transparent or otherwise can only display 256 colors so the results are somewhat limited. But, it may be just the solution to your problem.





http://www.absolutecross.com/tutorials/p...





If you are experienced with png images, you could also save your image as a 24-bit png, but because Internet Explorer 6 and lower doesn't support transparent png images directly, it would still take 50 or so lines of a javascript workaround script code to force older IE browsers to display pngs without the white background.
Reply:make the image the same size as the table, or vice versa, make the table the same size as the image, therefore you will get no whitespace between the image and the tables borders.





If you could please do us a favor and post the size of the table (width="" height="") and the image (### x ###) we can see if this is the case and then change it around for you.
Reply:try changing the margin or padding property of the table.


No comments:

Post a Comment