IE layers issue when dtd with doctype tag is not added
I am facing a very strange issue because of which when i do not add the bel开发者_运维百科ow line to the html the layers(z-index) is not working.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"; "_http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Please let me know if you are aware of the issue and how to get layers working without adding this tag.
Best Regards, Keshav
Modern versions of IE (7+) have different rendering engines, and choose their rendering engine based on the user's preferences and the page's doctype. So your problem is probably that whatever default rendering engine IE is using when you test your page (probably a compatibility mode) either has a rendering bug or exposes a bug in your mark-up that causes the z-index to not render properly. When you add the doctype, IE changes its rendering engine and the bug in the old rendering engine or your code disappears, so your z-index renders just fine.
There are two ways to fix this:
- You can try to tweak your mark-up so that the z-index is rendered correctly in both rendering engines. This might be a lot of work.
- You can make sure you always specify a doctype. This is a best practice, and you should always do it anyways.
精彩评论