MKumar
MKumar

Reputation: 76

ASP.net CSS max-width not working in IE8

I have one page created with ASP.net as well as in normal 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.

One problem is when I put

<!DOCTYPE html>

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

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.

Why ASP.net remove that from the page?

with <!DOCTYPE html> :

enter image description here

without <!DOCTYPE html> :

enter image description here

CSS for tile box

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

and for parent 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.

Upvotes: 1

Views: 535

Answers (1)

tahdhaze09
tahdhaze09

Reputation: 2213

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:

https://github.com/scottjehl/Respond

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

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

Upvotes: 1

Related Questions