<!DOCTYPE HTML> for IE
when i include the <!DOCTYPE HTML>
for IE v8 the dialog box are opening with the same sizes but the layout of the Page gets disturbed
any suggestions开发者_C百科 how to prevent the change in the web page layout ??
If you don't have a doctype tag, the page will be rendered in Quirks Mode. This means that it tries to be compatible with ancient versions of the browser, and for IE this means among other things that it uses a non-standard box model.
When you add a doctype tag the page will be rendered in Standards Compliance Mode, where the browser tries to follow the web standards as closely as possible.
If you have designed your page for Quirks Mode in IE, it's very likely that you have taken advantage of some of the rendering bugs in IE. This would mean that it doesn't render as you expect in any other browser, or in Standards Compliance Mode.
Specifying a doctype such as <!DOCTYPE html>
is a good thing.
If you don't specify a doctype, IE will fall back to rendering in "quirks mode", which is basically a backward compatiblity mode that renders the page as it would have been with IE5.5 and earlier.
All versions of IE since IE6 have supported the doctype as a mechanism for triggering standards mode. This means that the layout will be rendered using the correct rules, and should look the same in other browsers.
If your layout changes when you add a doctype, this means that your page has switched from quirks mode to standards mode. You can't prevent it from changing the layout; if it looked right in quirks mode and broken in standards mode, then it is the layout that is at fault and needs to be fixed.
You should adapt your layout to work with standards mode. You should also test the page in other browsers.
精彩评论