[英]ASP.net CSS max-width not working in IE8
我有一個用ASP.net和普通HTML創建的頁面。
問題是,當我在IE10中瀏覽該頁面時,所有CSS屬性都可以正常工作,但在IE8 max-width屬性不起作用的情況下。
一個問題是當我把
<!DOCTYPE html>
在<html>
標記之前,它也可以在IE8上正常運行,但不能正常運行。
在ASP.net的主頁中,我放了<!DOCTYPE html>
但是當我運行網站時,它將刪除它。 因此,它在IE8中不起作用。
為什么ASP.net從頁面中刪除它?
與<!DOCTYPE html>
:
沒有<!DOCTYPE html>
:
瓷磚盒的CSS
.tilebox {
color: white;
height: 60px;
line-height: 85px;
margin: 5px;
min-width: 180px;
padding: 15px;
text-align: center;
width: auto;
}
對於父div:
#boxcontainer {
height: auto;
margin: 0 auto;
max-width: 740px;
min-width: 200px;
padding: 0;
width: 100%;
}
對於ID為#boxcontainer max-width的div不起作用。
max-width
不是IE8的CSS定義的一部分。 我使用polyfill使其工作,特別是Scott Jehl的response.js:
https://github.com/scottjehl/Respond
這樣您就可以在CSS6(即IE8)中使用CSS3(包括媒體查詢)。
編輯-您需要HTML5文檔類型才能使其正常工作。 因此<!doctype HTML>
是必需的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.