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 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with LI height and vertical-align (Firefox)

    Hello,

    I have a problem with aligning image and text in <LI> element.

    Testcase: http://gamca.informacie.sk/betatest/test/index.html

    I set 20px line-height, but in Firefox 3 odd <LI> elements have 22px height and even <LI> elements have 21px height.

    What am I doing wrong?

    Thanks

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello kuvik,
    I've always had better luck replacing bullets by putting the image as a background of the li.
    Like this - http://nopeople.com/CSS/li_image/index.html

    Could try this too -
    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>
        <title>tests</title>
    	<style type="text/css">
    html, body {
    		font-size: 12px;
    		font-family: Verdana, Helvetica, sans-serif;
    		color: #222;
    		line-height: 20px;
    	}
    	
    	* {
    		padding: 0px;
    		margin: 0px;
    	}
    	
    	.sidebar-box {
    	}
    	
    	ul.sidebar-box {
    		list-style-type: none;
    		width: 200px;
    	}
    
    	.sidebar-box li {
    		background-color: #DDDDDD;
    		margin-bottom: 1px;
    	}
    	
    	.sidebar-box li * {
    vertical-align: middle;
    		margin-right: 6px;
    	}
    
    	</style>
    </head>
    
    <body>
    	<ul class="sidebar-box">
    
                    <li><img src="folder.png" alt="" /><a href="">Link 1</a></li>
    				<li><img src="folder.png" alt="" /><a href="">Link 2</a></li>
    				<li><img src="folder.png" alt="" /><a href="">Link 3</a></li>
    				<li><img src="folder.png" alt="" /><a href="">Link 4</a></li>
    				<li><img src="folder.png" alt="" /><a href="">Link 5</a></li>
    				<li><img src="folder.png" alt="" /><a href="">Link 6</a></li>
    
    			</ul>
    </body>
    
    </html>
    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


  •  

    Posting Permissions

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