2014-07-18 54 views
0

此CSS會使Button固定在我們網站的屏幕底部。向上或向下滾動時,按鈕保持固定在頁面的底部。在IE中,它只是將按鈕放在DIV代碼所在的位置,而不是將其浮動並將其固定到瀏覽器的底部。 Chrome和Safari都會在瀏覽器窗口的右下方顯示按鈕。我經歷了幾篇文章,嘗試了不同的CSS設置,但似乎無法得到它。任何幫助將不勝感激。謝謝!固定位置DIV在Chrome和Safari中可以正常工作,但在IE11中不能正常工作

<style type="text/css"> 
    div[id="bottomButton"] { 
     position: fixed; 
     bottom: -20px; 
     right: 45px; 
     border: none; 
     z-index: 50; 
     border-color: transparent; 
     width: inherit; 
    } 
</style> 
+0

您可以使用#bottomButtom代替[id =「bottomButton」]。 – Marcel

+0

你在頁面上有文檔類型嗎? – Klors

+0

http://jsfiddle.net/eL4Vy/1/在IE9中爲我工作 –

回答

1

您在代碼中缺少HTML文檔類型。嘗試下面的代碼。

<!DOCTYPE html> 
<html> 
<head> 
<script> 
</script> 
<style type="text/css"> 
    #bottomButton { 
     position: fixed; 
     bottom: -20px; 
     right: 45px; 
     border: none; 
     z-index: 50; 
     border-color: transparent; 
     width: inherit; 
    } 
</style> 
</head> 
<body> 
<div id="bottomButton"> 
<button>mybutton</button> 
</div> 

</body> 


</html> 
相關問題