[英]Fixed position DIV that works fine in Chrome and Safari but not in IE11
此CSS導致一個Button錨定在我們網站的屏幕底部。 向上或向下滾動時,該按鈕將停留在頁面底部。 在IE中,它只是將按鈕呈現在DIV代碼所在的位置,而不是將其浮動並固定在瀏覽器底部。 Chrome和Safari都在瀏覽器窗口的右下方顯示該按鈕。 我瀏覽了幾篇文章並嘗試了不同的CSS設置,但似乎無法理解。 任何幫助將不勝感激。 謝謝!
<style type="text/css">
div[id="bottomButton"] {
position: fixed;
bottom: -20px;
right: 45px;
border: none;
z-index: 50;
border-color: transparent;
width: inherit;
}
</style>
您的代碼中缺少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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.