Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. How to Remove Spurious Row Padding in Table

How to Remove Spurious Row Padding in Table

Scheduled Pinned Locked Moved Web Development
helptutorialquestion
7 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Patrick Skelton
    wrote on last edited by
    #1

    Hi, I have a very simple 2X2 table as follows:

    <table id="temp1" width="200px" cellpadding="0" cellspacing="0" border="0">
    <tr>
    <td>
    <img id="Img4" src="images/Logo100X100.jpg" height="100px" width="100px" />
    </td>
    <td>
    <img id="Img1" src="images/Logo100X100.jpg" height="100px" width="100px" />
    </td>
    </tr>
    <tr>
    <td>
    <img id="Img2" src="images/Logo100X100.jpg" height="100px" width="100px" />
    </td>
    <td>
    <img id="Img3" src="images/Logo100X100.jpg" height="100px" width="100px" />
    </td>
    </tr>
    </table>

    When the table renders, there is no vertical space between neighbouring horizontal images; however, there is a persistent small border at the bottom of each image. Nothing I do seems to affect its width or get rid of it (which is what I really want). Does anyone have any idea where this might be coming from? (I have checked the images themselves, and they have no border.) Any help would be very much appreciated. Best wishes, Patrick

    T L G 3 Replies Last reply
    0
    • P Patrick Skelton

      Hi, I have a very simple 2X2 table as follows:

      <table id="temp1" width="200px" cellpadding="0" cellspacing="0" border="0">
      <tr>
      <td>
      <img id="Img4" src="images/Logo100X100.jpg" height="100px" width="100px" />
      </td>
      <td>
      <img id="Img1" src="images/Logo100X100.jpg" height="100px" width="100px" />
      </td>
      </tr>
      <tr>
      <td>
      <img id="Img2" src="images/Logo100X100.jpg" height="100px" width="100px" />
      </td>
      <td>
      <img id="Img3" src="images/Logo100X100.jpg" height="100px" width="100px" />
      </td>
      </tr>
      </table>

      When the table renders, there is no vertical space between neighbouring horizontal images; however, there is a persistent small border at the bottom of each image. Nothing I do seems to affect its width or get rid of it (which is what I really want). Does anyone have any idea where this might be coming from? (I have checked the images themselves, and they have no border.) Any help would be very much appreciated. Best wishes, Patrick

      T Offline
      T Offline
      TweakBird
      wrote on last edited by
      #2

      Patrick Skelton wrote:

      there is no vertical space between neighbouring horizontal images;

      Try this code

      <table id="temp1" width="210px" cellpadding="0" cellspacing="0" border="0">
      <tr>
      <td>
      <img id="Img4" src="1.JPG" height="100px" width="100px" />
      </td>
      <td>
      <img id="Img1" src="1.JPG" height="100px" width="100px" />
      </td>
      </tr>
      <tr><td colspan="2"> </td></tr>
      <tr>
      <td>
      <img id="Img2" src="1.JPG" height="100px" width="100px" />
      </td>
      <td>
      <img id="Img3" src="1.JPG" height="100px" width="100px" />
      </td>
      </tr>
      </table>

      P 1 Reply Last reply
      0
      • T TweakBird

        Patrick Skelton wrote:

        there is no vertical space between neighbouring horizontal images;

        Try this code

        <table id="temp1" width="210px" cellpadding="0" cellspacing="0" border="0">
        <tr>
        <td>
        <img id="Img4" src="1.JPG" height="100px" width="100px" />
        </td>
        <td>
        <img id="Img1" src="1.JPG" height="100px" width="100px" />
        </td>
        </tr>
        <tr><td colspan="2"> </td></tr>
        <tr>
        <td>
        <img id="Img2" src="1.JPG" height="100px" width="100px" />
        </td>
        <td>
        <img id="Img3" src="1.JPG" height="100px" width="100px" />
        </td>
        </tr>
        </table>

        P Offline
        P Offline
        Patrick Skelton
        wrote on last edited by
        #3

        Hi, Thank you for the reply. The code gives me an equal border horizontally and vertically, which is neater, but I would still like to know if it is possible to have images within the cells of a table touching each other on all sides. I find it very difficult to believe this is not possible. I can (and probably should) do what I want with DIVs, but it is annoying me that I can't get rid of the space in the tables. Where are they coming from? Best wishes, Patrick

        T 1 Reply Last reply
        0
        • P Patrick Skelton

          Hi, Thank you for the reply. The code gives me an equal border horizontally and vertically, which is neater, but I would still like to know if it is possible to have images within the cells of a table touching each other on all sides. I find it very difficult to believe this is not possible. I can (and probably should) do what I want with DIVs, but it is annoying me that I can't get rid of the space in the tables. Where are they coming from? Best wishes, Patrick

          T Offline
          T Offline
          TweakBird
          wrote on last edited by
          #4

          Patrick Skelton wrote:

          I can (and probably should) do what I want with DIVs

          Go through this link[^]. I think it might be helpful. see this one also http://www.brunildo.org/test/img_center.html[^]

          1 Reply Last reply
          0
          • P Patrick Skelton

            Hi, I have a very simple 2X2 table as follows:

            <table id="temp1" width="200px" cellpadding="0" cellspacing="0" border="0">
            <tr>
            <td>
            <img id="Img4" src="images/Logo100X100.jpg" height="100px" width="100px" />
            </td>
            <td>
            <img id="Img1" src="images/Logo100X100.jpg" height="100px" width="100px" />
            </td>
            </tr>
            <tr>
            <td>
            <img id="Img2" src="images/Logo100X100.jpg" height="100px" width="100px" />
            </td>
            <td>
            <img id="Img3" src="images/Logo100X100.jpg" height="100px" width="100px" />
            </td>
            </tr>
            </table>

            When the table renders, there is no vertical space between neighbouring horizontal images; however, there is a persistent small border at the bottom of each image. Nothing I do seems to affect its width or get rid of it (which is what I really want). Does anyone have any idea where this might be coming from? (I have checked the images themselves, and they have no border.) Any help would be very much appreciated. Best wishes, Patrick

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Hi, I think it looks fine in most browsers; however Internet Explorer (and the WebBrowser Control) feel a need to add two pixels worth of white height. I'd call that a bug. :)

            Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

            1 Reply Last reply
            0
            • P Patrick Skelton

              Hi, I have a very simple 2X2 table as follows:

              <table id="temp1" width="200px" cellpadding="0" cellspacing="0" border="0">
              <tr>
              <td>
              <img id="Img4" src="images/Logo100X100.jpg" height="100px" width="100px" />
              </td>
              <td>
              <img id="Img1" src="images/Logo100X100.jpg" height="100px" width="100px" />
              </td>
              </tr>
              <tr>
              <td>
              <img id="Img2" src="images/Logo100X100.jpg" height="100px" width="100px" />
              </td>
              <td>
              <img id="Img3" src="images/Logo100X100.jpg" height="100px" width="100px" />
              </td>
              </tr>
              </table>

              When the table renders, there is no vertical space between neighbouring horizontal images; however, there is a persistent small border at the bottom of each image. Nothing I do seems to affect its width or get rid of it (which is what I really want). Does anyone have any idea where this might be coming from? (I have checked the images themselves, and they have no border.) Any help would be very much appreciated. Best wishes, Patrick

              G Offline
              G Offline
              Graham Breach
              wrote on last edited by
              #6

              It's a bug in IE - the white space inside the table cell is taking up some space. Try this:

              <table id="temp1" width="200px" cellpadding="0" cellspacing="0" border="0">
              <tr>
              <td><img id="Img4" src="images/Logo100X100.jpg" height="100px" width="100px" /></td>
              <td><img id="Img1" src="images/Logo100X100.jpg" height="100px" width="100px" /></td>
              </tr>
              <tr>
              <td><img id="Img2" src="images/Logo100X100.jpg" height="100px" width="100px" /></td>
              <td><img id="Img3" src="images/Logo100X100.jpg" height="100px" width="100px" /></td>
              </tr>
              </table>

              P 1 Reply Last reply
              0
              • G Graham Breach

                It's a bug in IE - the white space inside the table cell is taking up some space. Try this:

                <table id="temp1" width="200px" cellpadding="0" cellspacing="0" border="0">
                <tr>
                <td><img id="Img4" src="images/Logo100X100.jpg" height="100px" width="100px" /></td>
                <td><img id="Img1" src="images/Logo100X100.jpg" height="100px" width="100px" /></td>
                </tr>
                <tr>
                <td><img id="Img2" src="images/Logo100X100.jpg" height="100px" width="100px" /></td>
                <td><img id="Img3" src="images/Logo100X100.jpg" height="100px" width="100px" /></td>
                </tr>
                </table>

                P Offline
                P Offline
                Patrick Skelton
                wrote on last edited by
                #7

                Hi, Thanks to everyone who has replied. I've tried the code suggested by Graham Breach, but unfortunately I still get a 4-pixel horizontal gap in IE8. A couple of comments have suggested this is an IE bug, so I tried it in Chrome, and I got a 5-pixel gap in that, so there is some other dark force at work here. I can do what I need with DIVs, but it is very annoying. Best wishes, Patrick

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups