2009-11-29 65 views
3

由于某些原因,我的LI元素未在Internet Explorer中左侧浮动,它们分别显示在下方。任何人都知道我该如何解决这个问题?Internet Explorer 8中的LI元素

#books ul{ 
    list-style:none; 
    margin:0px; 
    float:left; 
    display:inline; 
} 
#books ul li{ 
    float:left; 
    margin-right: 20px; 
    padding-bottom: 20px; 
    height:300px; 
    display:inline; 
} 
+0

你能提供html和css吗?它在其他浏览器等工作? – 2009-11-29 06:33:36

+0

我在问题中添加了css。是的,它在Firefox中工作正常。 – ryudice 2009-11-29 06:42:18

+1

您使用兼容性视图吗? – 2009-11-29 06:47:17

回答

4

如果我正确理解您的问题,它可能与设置显示:内联。更改为显示:块;似乎解决了IE和FF的问题。

#books ul{ 
list-style:none; 
margin:0px; 
float:left; 
display:block;} 

#books UL李{ 浮动:左; margin-right:20px; padding-bottom:20px; height:300px; 显示:块;}

+3

它们在默认情况下已经被阻止,所以我只是删除整个属性。 – BalusC 2009-11-29 16:20:04

0

没有必要使用浮动,如果你只是想每个L1是内联,你可以只使用display属性。

#books ul{ 
    width: 100%; 
    list-style: none; 
    margin: 0px; 
} 
#books ul li{ 
    margin-right: 20px; 
    padding-bottom: 20px; 
    height: 300px; 
    display: inline-block; 
}