HTML/CSS
1. 默認margin、padding不一致
* {margin: 0;padding: 0;}
2. css3的animation
IE9不支持
3. display: flex
IE9不支持;IE10部分支持,使用display: ms-flexbox flexbugs@github
IE10下,justify-content 對容器內的span不起作用,需要設置span display: block/inline-block
IE11支持不加前綴的flex,且flex容器內部各部分寬度相同(與其他瀏覽器不一致),解決辦法是設置容器內部各成員 width: auto
在 IE11 上 align-items 對於設置 min-height 的父元素不能實現垂直居中,改爲設置height即可
4. 多個img放在一起時,部分瀏覽器會有默認間距
img使用float佈局
5. webkit / trident 中 iframe 有默認高度 其他無
6. IE11 th標籤默認對齊方式爲center,chrome爲left,由於默認值的原因,若text-align是繼承於父級的,也無效
9. IE11 button默認overflow:hidden,chrome爲visible
10. PC上iframe內容超出時無法滾動,而移動端可滾動,且iframe內文本會自動換行
11. IE11 僞元素超出父元素邊界的部分不會顯示
12. IE11下使用負邊距後該元素可能超出父元素邊界,如果父元素有overflow則會出現滾動條(如使用負邊距居中定位時)
13. IE11下color: #xxxxxx可能不能識別chrome那邊能生成的顏色值,如8位的顏色值,使用六位的即可
14. IE Get請求如果參數相同,會直接使用緩存(頭部添加cache-control: no-cache和pragma:no-cache)
JS
1. IE11中status 302的請求的response爲undefined,並且request.status爲0
2. IE11中使用js改變input的value會觸發input的onchange事件,其他瀏覽器不會
// 若在onchange事件中對輸入框處理完畢後手動設置value,會再次觸發onchange事件
document.getElementById('#input').value = ''
3. IE11等瀏覽器不支持input選擇文件夾(添加webkitdirectory屬性)
4. IE若要阻止默認事件,使用event.returnValue = false,其他瀏覽器使用event.preventDefault()
5. IE若要阻止事件冒泡,使用event.cancelBubble = true,其他瀏覽器使用event.stopPropagation()
6. IE獲取元素計算好的樣式,使用el.currentStyle(),其他瀏覽器使用el.getComputedStyle()
7. IE、Edge內使用window.postMessage時必須制定第二個參數
PS:注意編譯器的格式化代碼,如VSCode裏的Prettier,若設置了添加自動結尾comma,在format時會自動加逗號,這個ES6+特性在IE下是不支持
歡迎關注、點贊