4 Replies Latest reply on Jul 11, 2007 2:43 PM by Newsgroup_User

    image in a div

    Level 7
      I have an image inside a div and it give me some extra space at the
      bottom, instead of wrapping the image tight. The pieceholder has a
      background color, so I can see that color below the image. How can I get
      rid of this?

      Thanks,
      B


      <div class="pieceholder">
      <img src="img/portfolio/01.jpg">
      </div>
      <br style="clear: both;" />
        • 1. Re: image in a div
          bunck
          Do you have a margin set on your CSS tag or perhaps a height
          • 2. Re: image in a div
            Level 7
            .oO(Brian)

            >I have an image inside a div and it give me some extra space at the
            >bottom, instead of wrapping the image tight. The pieceholder has a
            >background color, so I can see that color below the image. How can I get
            >rid of this?

            Try adding

            img {vertical-align: bottom}

            to your CSS. You should also _always_ validate your HTML and CSS code,
            the example you posted contains 2 errors in just 4 lines ...

            Micha
            • 3. Re: image in a div
              Level 7
              Brian wrote:
              > I have an image inside a div and it give me some extra space at the
              > bottom, instead of wrapping the image tight. The pieceholder has a
              > background color, so I can see that color below the image. How can I get
              > rid of this?
              >
              > Thanks,
              > B
              >
              >
              > <div class="pieceholder">
              > <img src="img/portfolio/01.jpg">
              > </div>
              > <br style="clear: both;" />

              in some browsers, images being displayed inline have a little space below them , which is the space
              that the lower legs of letters would take.
              To remove this, try:

              <img src="img/portfolio/01.jpg" style="display:block">


              --
              seb ( ---@webtrans1.com)
              http://webtrans1.com | high-end web design

              An Ingenious WebSite Builder: http://sitelander.com
              • 4. Re: image in a div
                Level 7
                Thank you everyone! I used img {vertical-align: bottom} and that works
                great!

                Thank you!