Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2008
    Posts
    18
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Linked image padding in <li> element

    Hi to everyone,

    I have a strange problem:

    Linked image is in <li> under <ul>

    All elements have padding and margin set to "0" except <li> (bottom margin 7px)

    FireFox adds some kind of padding below the image

    How can I remove this? What's the problem?

    Thanks a lot in any case

    Here's the code:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test</title>
    <style type="text/css">
    <!--
    ul {
    	margin: 0px;
    	padding: 0px;
    	list-style-type: none;
    }
    li {
    	background-color: #CCC;
    	margin-bottom: 7px;
    	margin-top: 0px;
    	margin-right: 0px;
    	margin-left: 0px;
    	padding: 0px;
    }
    img {
    	border-top-width: 0px;
    	border-right-width: 0px;
    	border-bottom-width: 0px;
    	border-left-width: 0px;
    	border-top-style: none;
    	border-right-style: none;
    	border-bottom-style: none;
    	border-left-style: none;
    	margin: 0px;
    	padding: 0px;
    }
    ul li img a {
    	margin: 0px;
    	padding: 0px;
    	border-top-width: 0px;
    	border-right-width: 0px;
    	border-bottom-width: 0px;
    	border-left-width: 0px;
    	border-top-style: none;
    	border-right-style: none;
    	border-bottom-style: none;
    	border-left-style: none;
    }
    a {
    	margin: 0px;
    	padding: 0px;
    }
    -->
    </style>
    </head>
    
    <body>
    <ul>
      <li><a href="#"><img src="http://www.google.com/intl/en_ALL/images/logo.gif" width="276" height="110" alt="Google" /></a></li>
      <li>Second item</li>
      <li>Third</li>
      <li>Fourth</li>
      <li>Fifth</li>
    </ul>
    </body>
    </html>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Are you talking about that mysterious gap?
    If so, have a try by adding
    Code:
    li > a > img{
     display:block;
    }
    Last edited by abduraooft; 06-19-2009 at 10:13 AM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    batric (06-20-2009)

  • #3
    New Coder
    Join Date
    Oct 2008
    Posts
    18
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    Are you talking about that mysterious gap?
    If so, have a try by adding
    Code:
    li > a > img{
     display:block;
    }
    That solved the problem!

    Thanks a lot!


  •  

    Posting Permissions

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