[英]Why does the outline of this text input display differently in Chrome than Firefox?
[英]why does the page display differently in IE than google chrome?
某些頁面通常在 IE 中顯示非常糟糕,解決這些問題的最佳方法是什么?
您忘記添加doctype ,因此您的頁面處於Quirks 模式。
添加這個(HTML5 doctype)作為第一行:
<!DOCTYPE html>
它應該看起來更好。
雖然,手動更改文檔模式(使用開發者工具;按 F12),它仍然看起來不正確。 該頁面顯然還有其他問題。
最相關的問題(在 escaping Quirks Mode 之后)是這樣的:
<body style="margin: 0; padding; 0;background-color: 4DA2CA;">
Internet Explorer 未顯示任何背景顏色,因為您忘記了顏色前的#
。 (並且您有padding; 0
,帶有;
而不是:
)
這將起作用:
<body style="margin: 0; padding: 0; background-color: #4DA2CA">
但是您首先不應該使用內聯 styles ..
這會更好:
<body>
在您的樣式表中使用 CSS :
body {
margin: 0;
padding: 0;
background-color: #4DA2CA
}
你的意思是,在 IE 中,Div 更小。那是因為在 IE css 邊框中,邊距包含在聲明的寬度中。所以,如果你給了一個 100px 的 div 寬度和 10px 兩邊的邊距,那么在 IE 中實際可見寬度這個 div 的大小將是 100-10-10=80px。要解決這個問題,您可以使用子 css decleration。 考慮我們的示例,如果您想在兩個瀏覽器中顯示此 div 100px 寬度,請執行以下操作
.mydiv{ /*This deceleration will be understood by all the browsers*/
margin:10px;
width:120px;
}
html>body .mydiv{ /*This deceleration will not be understood by IE browsers so other will override the width*/
width:100px;
}
使用它,您可以在 IE 和非 ie 瀏覽器中統一 Div 的寬度
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.