SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist Barnum's Avatar
    Join Date
    Oct 2008
    Posts
    418
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Closing the gap between img and caption

    I am using the following code to place an image with a caption on my page.... How do I reduce the space between the two. I want to move the caption close to the photo.

    <table align="right">
    <tr>

    <td>
    <img src="images/Stephan.jpg" width="300" height="200">
    </td>

    </tr>


    <td>
    <center><b><font color="#8A360F">The Stephaniturm</font></center>
    </td>

    </tr>
    </table>

  2. #2
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,821
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    We would need to see matching CSS..

    OR, if you don't mind changing your markup, you could put the IMG AND the markup in the same TD.


    So the NEW code would be:

    Code:
    <table align="right">
    <tr>
    <td class='imgAndCapt'>
    <img src="images/Stephan.jpg" width="300" height="200">
     <b>The Stephaniturm</b>
    </td>
    </tr>
    </table>
    and the NEW CSS

    Code:
    .imgAndCapt{text-align:center;}
     .imgAndCapt b {color: #8A360F; display:block;  
          margin-top: 15px ; /*change the value to what ever  spacing you want to put between the caption and image */
    }
    hope that helps

  3. #3
    SitePoint Evangelist Barnum's Avatar
    Join Date
    Oct 2008
    Posts
    418
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    That did the job....thanks very much. I appreciate it. Would have been embarrassed to put up my code. You guys are always there to help, and I appreciate it.

  4. #4
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,821
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    You are welcome. and never be embarrassed, B.. We are happy to help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •