2009-11-29 97 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; 
}