0

This has been driving me crazy. There is always aqua showing around the image! I am trying to completely fill the cell with the image, so there is no gap.

<!doctype html>
<html>
<head>
</head>

<body>
    <table style="border-spacing: 0; background-color: black;">
    <tr>
        <td style="width: 600px; height: 44px; border-spacing: 0; background-color: aqua">
        <img style="display: block; width: 100%" src="...banner.jpg">
        </td></tr></table>
</body>
</html>
  • 1
    Try removing `width: 600px; height: 44px;` If you set dimensions larger than the image, then the `background-color: aqua` will show – Rojo Aug 31 '21 at 18:03
  • Those dimensions are actually the exact size of the image. I removed it and the problem remains. There is always an area around the image that shows the background, it never completely fills the cell. – Bryan Monesson-Olson Aug 31 '21 at 18:12
  • 1
    https://stackoverflow.com/questions/11578819/css-reset-what-exactly-does-it-do – epascarello Aug 31 '21 at 18:45

2 Answers2

0

I'm curious if someone can explain this to me. I have corrected my issue, but I don't understand how. I set the margin and padding to 0px. Why was there a margin or padding? Is there a default value for them?

<!doctype html>
<html>
<head>
</head>

<body style="background: yellow">
    <table style="border-spacing: 0; background-color: black;">
    <tr>
        <td style="border-spacing: 0; padding: 0px; margin: 0px; background-color: aqua">
        <img style="display: block; width: 100%" src="http://blogs.umass.edu/bolson/files/2021/08/CCPH-Banner.jpg">
        </td></tr></table>
</body>
</html>
-1

Try this code

<!doctype html>
<html>
<head>
</head>

<body>
    <table style="border-spacing: 0; background-color: black;">
    <tr>
        <td style="width: 600px; height: 44px; border-spacing: 0; background-color: transparent;>
        <img style="display: block; width: 100%" src="...banner.jpg">
        </td></tr></table>
</body>
</html>