www.webdeveloper.com
Results 1 to 3 of 3

Thread: Gap on image bottom ?

  1. #1
    Join Date
    Feb 2009
    Posts
    124

    Gap on image bottom ?

    Gap on image bottom ?

    I know it's another simple one but I can't work it out

    I have a list of images here and they all seem to have a gap at the
    bottom. What's causing the gap?

    http://www.ttmt.org.uk/css/


    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    
    	<title>untitled</title>
    	<style type="text/css" media="screen">
    	 *{
    	   margin:0;
    	   padding:0;
    	 }
    	 body{
    	   background:#eee;
    	 }
    	 li{
    	   background:white;
    	   list-style:none;
    	   border: 1px solid red;
    	   margin:0 0 10px 0;
    	   padding:0;
    	 }
    	 #wrap{
    	   margin:30px;
    	   width:300px;
    	 }
    	 img{
    	   border:0;
    	   padding:0;
    	   margin:0;
    	 }
    	 a{
    	   border:0;
    	   padding:0;
    	   margin:0;
    	 }
    	</style>
    </head>
    
    <body>
    
      <div id="wrap">
        <ul>
          <li><a href=""><img src="01.jpg" alt="" /></a></li>
          <li><a href=""><img src="02.jpg" alt="" /></a></li>
          <li><a href=""><img src="03.jpg" alt="" /></a></li>
          <li><a href=""><img src="04.jpg" alt="" /></a></li>
        </ul>
      </div><!-- #wrap -->
    
    </body>
    </html>

  2. #2
    Join Date
    Aug 2006
    Posts
    1,886
    Add a display:block to your image style, that should fix it.

    Dave

  3. #3
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,198
    All the following is not required since you have the universal selector:

    Code:
     img{
    	   border:0;
    	   padding:0;
    	   margin:0;
    	 }
    	 a{
    	   border:0;
    	   padding:0;
    	   margin:0;
    	 }
    I would actually use it like this:

    * { margin:0; padding:0; border: 0; } Just added the border one. :P

    May be a gap depending on image sizes and whether the list is larger as you do have a white background as well as a 1px border. Plus, a 10px bottom margin for each li.
    Last edited by Major Payne; 03-14-2012 at 04:10 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles