Connecting Tech Pros Worldwide Help | Site Map

IE - Working with lists and gaps

Member
 
Join Date: Apr 2008
Posts: 45
#1: Aug 4 '09
In IE (7 and 8 are my concern) I have some list items that are more than one line. I'm not sure if this is what causes it but my lists have large gaps between them. It looks horrendous.

Anybody know a work around?


this is my css and html

Expand|Select|Wrap|Line Numbers
  1. <ul>
  2. <li>
  3. <a href="my.html">Testing Link</a>
  4. </li>
  5.  
  6. </ul>
  7.  
Expand|Select|Wrap|Line Numbers
  1. #leftpane ul
  2. {
  3.     padding:0px;
  4.     margin:0px;
  5.     list-style:none;
  6. }
  7. #leftpane ul li
  8. {
  9.     padding:0px;
  10.     margin:0px;
  11. }
  12. #leftpane ul li a
  13. {
  14.     display:    block;
  15.     font-size:    90%;
  16. }
  17. #leftpane ul li a:hover
  18. {
  19.     display:    block;
  20.     background:    #EAEAEA;
  21. }
  22.  
  23.  
  24.  
jhoborg's Avatar
Newbie
 
Join Date: Aug 2009
Location: in a hole
Posts: 6
#2: Aug 4 '09

re: IE - Working with lists and gaps


When you choose to use "display:block" on your elements it puts a line break before and after the element, so I think that is what's causing your list items to be more than one line.
Member
 
Join Date: Apr 2008
Posts: 45
#3: Aug 4 '09

re: IE - Working with lists and gaps


I need them block so the width words properly on the mouseover. maybe I should include a clear... I don't really know.
jhoborg's Avatar
Newbie
 
Join Date: Aug 2009
Location: in a hole
Posts: 6
#4: Aug 5 '09

re: IE - Working with lists and gaps


Are you declaring your doctype? If not that might be the reason why it's adding unwanted space in IE.

You could also try adding "width:100%;" to the "a" elements. Assuming of course that works for your layout and what you are trying to accomplish. Like so:

Expand|Select|Wrap|Line Numbers
  1. #leftpane ul li a
  2. {
  3.     display:    block;
  4.     font-size:    90%;
  5.     width:100%;
  6. }
  7. #leftpane ul li a:hover
  8. {
  9.     display:    block;
  10.     background:    #EAEAEA;
  11.     width:100%;
  12. }
  13.  
Member
 
Join Date: Apr 2008
Posts: 45
#5: Aug 5 '09

re: IE - Working with lists and gaps


The doc type is declared. Add 100% width fixed the problem, at least in IE8. Thanks kindly!
Reply