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 7 of 7
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    gap problem with IE

    I have a selection of 4 list items, which are images that I want to fit close together vertically. I have done this before but for some reason this time, nothing seems to change with different values, it's driving me nuts as I have tried numerous fixes for this but I am pretty sure that it's something I'm missing. I would be really greatful if someone could point out why it's happening so I know for the future.

    CSS

    Code:
    body {
    
    	background: #071E30;
    	color: white;
    
    }
    
    a {text-decoration: none; color: #fff;}
    a:hover {text-decoration: underline;}
    img {border: none;}
    
    #wrap {
    
    	margin-top: 3px;
    	margin-left: 60px;
    	padding: 0px;
    	width: 880px;
    	height: 560px;
    	
    
    }
    
    
    	
    
    #synthbg {
    
    	margin-left: 0px;
    	margin-top: 0px;
    	list-style: none;
    	height: 601px;
    	width: 486px;
    	padding: 0px;
    	
    	
    
    }
    
    
    #synthbg li {
    height:10px;
    text-align: center;
    line-height:40px;
    }
    HTML

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                "http://www.w3.org/TR/html4/strict.dtd"><html>
    
    <head>
    
    
      <meta name="author"
            content="Becka Dawson">
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="Keywords" content="chris, chris jennings, jennings, music, stoke-on-trent, hanley, stoke, north, studio, music, depeche mode, composer, sound designer,">
    <meta name="Title" content="Rainstorm - Photography">
    <meta name="Description" content="Rainstorm v2.0 is an online portfolio for Rebecca Dawson's creative exploration within photography and visual art. ">
    
    
    <title>Chris Jennings Music - Profile</title>
    
    <link rel="stylesheet" type="text/css" href="styleIE.css">
    
    </head>
    
    <body>
    
    <div id="wrap">
    
    <ul id="synthbg">
    
    <li><img src="images/synth1.jpg"></li>
    <li><img src="images/synth2.jpg"></li>
    <li><img src="images/synth3.jpg"></li>
    <li><img src="images/synth4.jpg"></li>
    
    </ul>
    
    </div>
    
    </body>
    
    </html>

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Code:
    #synthbg li {
    height:10px;
    text-align: center;
    line-height:40px;
    font-size:0;
    }
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Jan 2006
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks so much for that! How did that actually work for future reference?

    Becka

  • #4
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    What's happening is the list items make room for the font plus the line-height. So by resetting the font-size to zero, you're effectively using the line-height only.

    You can also avoid this by using "display: block" on the list items, which will give the list items the ability to have an explicit height and width, although then you need a different method to position them.

  • #5
    Regular Coder
    Join Date
    Jan 2006
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ah that's really helpful cheers

    Becka

  • #6
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Since you run into that problem in so many places I always add
    Code:
    html, body {
         margin: 0;
         padding: 0;
    }
    * {
         margin: 0;
         padding: 0;
    }
    to the CSS and then specify margin, padding, line-height and font size as needed for each div.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #7
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,783
    Thanks
    6
    Thanked 1,022 Times in 995 Posts
    Quote Originally Posted by Excavator View Post
    Since you run into that problem in so many places I always add
    Code:
    html, body {
         margin: 0;
         padding: 0;
    }
    * {
         margin: 0;
         padding: 0;
    }
    to the CSS and then specify margin, padding, line-height and font size as needed for each div.
    If you're doing this you can actually leave the first rule and just use the second one as that will address every element anyway (the body and html elements).


  •  

    Posting Permissions

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