ASP.net CSS max-width在IE8中不起作用

时间:2021-08-17 03:18:11

I have one page created with ASP.net as well as in normal HTML.

我有一个用ASP.net和普通HTML创建的页面。

Issue is when I browse that page in IE10, all CSS property working fine but in case of IE8 max-width property not working.

问题是当我在IE10中浏览该页面时,所有CSS属性都正常工作但是在IE8 max-width属性不起作用的情况下。

One problem is when I put

一个问题是我放的时候

<!DOCTYPE html>

before <html> tag it works fine with IE8 also but without it not working.

在标签之前,IE8也能正常工作但没有工作。

In ASP.net in master page I put <!DOCTYPE html> but when I run website it will remove that. So its not working in IE8.

在主页中的ASP.net中我放了<!DOCTYPE html>但是当我运行网站时它将删除它。所以它不适用于IE8。

Why ASP.net remove that from the page?

为什么ASP.net会从页面中删除它?

with <!DOCTYPE html> :

与<!DOCTYPE html>:

ASP.net CSS max-width在IE8中不起作用

without <!DOCTYPE html> :

没有<!DOCTYPE html>:

ASP.net CSS max-width在IE8中不起作用

CSS for tile box

瓷砖框的CSS

.tilebox {
    color: white;
    height: 60px;
    line-height: 85px;
    margin: 5px;
    min-width: 180px;
    padding: 15px;
    text-align: center;
    width: auto;
   }

and for parent div:

并为父div:

#boxcontainer {
    height: auto;
    margin: 0 auto;
    max-width: 740px;
    min-width: 200px;
    padding: 0;
    width: 100%;
}

for div with id #boxcontainer max-width is not working.

对于id为#boxcontainer的div,max-width不起作用。

1 个解决方案

#1


1  

max-width is not a part of the CSS definition for IE8. I use a polyfill to make it work, specifically Scott Jehl's respond.js:

max-width不是IE8 CSS定义的一部分。我使用polyfill使它工作,特别是Scott Jehl的respond.js:

https://github.com/scottjehl/Respond

https://github.com/scottjehl/Respond

So you get CSS3, including media queries, to work in IE6 - IE8.

所以你得到CSS3,包括媒体查询,在IE6 - IE8中工作。

EDIT - You need the HTML5 doctype to make it work. so the <!doctype HTML> is required.

编辑 - 您需要HTML5文档类型才能使其正常工作。所以<!doctype HTML>是必需的。

#1


1  

max-width is not a part of the CSS definition for IE8. I use a polyfill to make it work, specifically Scott Jehl's respond.js:

max-width不是IE8 CSS定义的一部分。我使用polyfill使它工作,特别是Scott Jehl的respond.js:

https://github.com/scottjehl/Respond

https://github.com/scottjehl/Respond

So you get CSS3, including media queries, to work in IE6 - IE8.

所以你得到CSS3,包括媒体查询,在IE6 - IE8中工作。

EDIT - You need the HTML5 doctype to make it work. so the <!doctype HTML> is required.

编辑 - 您需要HTML5文档类型才能使其正常工作。所以<!doctype HTML>是必需的。