1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Making an image a link adds a background I can't get rid of

Discussion in 'CSS' started by sgware, Aug 18, 2006.

  1. #1
    Ok, I'm not really sure how to describe this, so I'll just show an example.

    Check out this:
    http://www.l4eclan.com/bipco/wtf1.htm
    and
    http://www.l4eclan.com/bipco/wtf2.htm

    They are the exact same code, except that in the second one the buttons ('Products,' 'Services,' etc.) are linked somewhere. For some crazy reason, making them links adds whitespace around them that I can't seem to get rid of.

    I have tried setting the border, margin, and padding of the <img>, <a>, and <li> tags to 0, to no avail. :( Can anyone tell me how to get rid of that damn whitespace? If I set the background color of the <a> tags to blue, it makes the whitespace blue... if that helps any. If I make the border, margin, or padding colors of those same tags blue, it doesn't show up. Weird.

    Any ideas?
     
    sgware, Aug 18, 2006 IP
  2. MarkB

    MarkB Peon

    Messages:
    33
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In your CSS, change:

    
    .menu a, .menu h2 { display: block;
    					border-style: none;
    					margin: 0;
    					padding: 2px 3px; }
    
    Code (markup):
    to:

    
    .menu a, .menu h2 { display: block;
    					border-style: none;
    					margin: 0; }
    
    Code (markup):
     
    MarkB, Aug 18, 2006 IP
  3. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #3
    Add
    
    a img {
        display: block;
        }
    Code (markup):
    An inline image is set above the bottom of its container, and the white space before and/or after it in the source is collapsed to a space; thus the extra space.

    cheers,

    gary
     
    kk5st, Aug 18, 2006 IP
  4. sgware

    sgware Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thank you! That works prefectly. :)
     
    sgware, Aug 18, 2006 IP
  5. ramakrishna p

    ramakrishna p Notable Member

    Messages:
    1,798
    Likes Received:
    361
    Best Answers:
    0
    Trophy Points:
    240
    #5
    Great to know that your question has been answered. Introduce yourself in the introduction section. Meet many more professionals on this forum.
     
    ramakrishna p, Aug 18, 2006 IP