Results 1 to 4 of 4

Thread: CSS question regarding line spacing

  1. #1
    Who does #2 work for? AmateurFlix's Avatar
    Join Date
    Oct 2005
    Posts
    13,986

    Default CSS question regarding line spacing

    Can anyone tell me why the first 4 links in this code have a different line spacing than the last 4?

    Code:
    <html> 
    <head> 
    <style type="text/css">
    .paysites a {text-decoration: none; font: 12px Arial, Verdana; color: #0000FF;}
    .paysites a:hover {text-decoration: underline; color: #FF0000;}
    </style>
    </head> 
    <body>
    <TABLE class=paysites BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="100%" ALIGN="CENTER">
    <TR>
    <TD>
    
    <IMG SRC="" HEIGHT=10 WIDTH=10 BORDER=0 ALT="">&nbsp;<a href="http://domain.com" target="_blank">anchor text</a><BR>
    <IMG SRC="" HEIGHT=10 WIDTH=10 BORDER=0 ALT="">&nbsp;<a href="http://domain.com" target="_blank">anchor text</a><BR>
    <IMG SRC="" HEIGHT=10 WIDTH=10 BORDER=0 ALT="">&nbsp;<a href="http://domain.com" target="_blank">anchor text</a><BR>
    <IMG SRC="" HEIGHT=10 WIDTH=10 BORDER=0 ALT="">&nbsp;<a href="http://domain.com" target="_blank">anchor text</a><BR>
    <a href="http://domain.com" target="_blank">anchor text</a><BR>
    <a href="http://domain.com" target="_blank">anchor text</a><BR>
    <a href="http://domain.com" target="_blank">anchor text</a><BR>
    <a href="http://domain.com" target="_blank">anchor text</a><BR>
    
    </TD>
    </TR>
    </TABLE>
    </body>
    </html>
    When I put an <img> tag on a line, it generates extra space between the lines, even though the img is only 10px high and the font is 12px. It doesn't matter if I reduce the img to 1 pixel high, it still does this. I tried specifying line-height, however that was ignored for lines containing img's.
    Last edited by AmateurFlix; July 29th, 2010 at 11:29 PM. Reason: this wasn't just happening in IE, it does the same in FF

  2. #2
    from accounting
    Join Date
    Oct 2005
    Location
    California
    Posts
    16,513

    Default

    Because of the non-breaking space after the image.
    Hosting for ADX provided by Swiftwill

  3. #3
    Who does #2 work for? AmateurFlix's Avatar
    Join Date
    Oct 2005
    Posts
    13,986

    Default

    thanks CraK, if I just include some blank space within the image, that should achieve the look I want.

  4. #4
    from accounting
    Join Date
    Oct 2005
    Location
    California
    Posts
    16,513

    Default

    You can just use CSS to do that once the non-breaking space is taken out.

    img {margin: 0 5px 0 0;}
    Hosting for ADX provided by Swiftwill

Posting Permissions

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